setup_orekit_data() fails when orekitdata library not available
To reproduce:
- Install orekit_jpype + matplotlib + ipykernel in a clean venv
- Do not install the orekitdata library
- run examples/Example_EarthObservation_-_Attitude_Sequence-jpype.ipynb
-
setup_orekit_data()
returns the following error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[4], line 1
----> 1 setup_orekit_data()
File /media/ssd/git/orekit_jpype/orekit_jpype/pyhelpers.py:162, in setup_orekit_data(filenames, from_pip_library)
151 def setup_orekit_data(filenames: Union[str, List[str], None] = None, from_pip_library: bool = True) -> None:
152 """
153 Sets up the orekit data from a file, folder or list of files/folders.
154 Can also load the data from the `orekitdata` python library. (default)
(...)
159
160 """
--> 162 setup_orekit_curdir(filename=filenames, from_pip_library=from_pip_library)
File /media/ssd/git/orekit_jpype/orekit_jpype/pyhelpers.py:119, in setup_orekit_curdir(filename, from_pip_library)
114 print(f"""Failed to load orekitdata library.
115 Install with `pip install git+https://gitlab.orekit.org/orekit/orekit-data.git`
116 Will try to load Orekit data using the folder or filename {filename}""")
118 if not data_load_from_library_sucessful:
--> 119 datafile = File(filename)
120 if not datafile.exists():
121 print('File or folder:', datafile.getAbsolutePath(), ' not found')
TypeError: Ambiguous overloads found for constructor java.io.File(NoneType) between:
public java.io.File(java.lang.String)
public java.io.File(java.net.URI)
Whereas I tested the same thing with the Orekit JCC wrapper, it does not have this error.
When installing the orekitdata library, the error vanished as expected.