HydrologicEngineeringCenter / Vortex

data processing utilities
MIT License
26 stars 7 forks source link

Issue with running a script using Jython #57

Closed tharunpalla closed 2 years ago

tharunpalla commented 2 years ago

I am unable to run the met_data_import.bat file with the following settings: I have installed Jython and have Java11 in my classpath

set "VORTEX_HOME=C:\Users\chand\Downloads\HEC_DSS_Automation\Vortex"
set "PATH=%VORTEX_HOME%\bin;%VORTEX_HOME%\bin\gdal;C:\Users\chand\Downloads\openjdk-11.0.2_windows-x64_bin\jdk-11.0.2;C:\Users\chand\AppData\Local\Programs\Python\Python39;%PATH%"
set "GDAL_DATA=%VORTEX_HOME%\bin\gdal\gdal-data"
set "PROJ_LIB=%VORTEX_HOME%\bin\gdal\projlib"
set "CLASSPATH=%VORTEX_HOME%\lib\*;"
set "PYTHONPATH=C:\Users\chand\AppData\Local\Programs\Python\Python39;

C:\Programs\jython2.7.2\bin\jython.exe -J-Xmx2g -Djava.library.path=%VORTEX_HOME%\bin;%VORTEX_HOME%\bin\gdal;%CLASSPATH%;%GDAL_DATA%;%PROJ_LIB% -Dpython.path=%PYTHONPATH%   met_data_import.py

The following is the error:

 met_data_import.pyTraceback (most recent call last):
  File "met_data_import.py", line 1, in <module>
    from mil.army.usace.hec.vortex.io import BatchImporter
ImportError: cannot import name BatchImporter
openSourcerer9000 commented 2 years ago

Hm I can recreate this by pointing VORTEX_HOME to "vortex-master" the whole folder of this repo I downloaded from Github. If I point it to the root folder of this specific version I downloaded it works fine https://github.com/HydrologicEngineeringCenter/Vortex/releases/tag/v0.10.27-rc.1

Not sure if this makes a difference, but I'm on windows and I happen to have its parent folder added to PATH in environment variables.

tombrauer commented 2 years ago

Just to clarify VORTEX_HOME should be the path to the vortex distribution package and not the path to the vortex source code. If there is a an “src” folder in the path root you are pointing to source code and there are no compiled artifacts to run against.

danhamill commented 2 years ago

I also think you don't need to set a PYTHONPATH in the batch file.

tharunpalla commented 2 years ago

Just to clarify VORTEX_HOME should be the path to the vortex distribution package and not the path to the vortex source code. If there is a an “src” folder in the path root you are pointing to source code and there are no compiled artifacts to run against.

Thanks Tom, I was using the path of the vortex source code. I updated the path to the vortex distribution package and was able to run the bat file.

tharunpalla commented 2 years ago

Issue was resolved