ESMG / pyroms

Python tools for the Regional Ocean Modeling System (ROMS)
Other
141 stars 88 forks source link

Fix imports for compiled Fortran modules #15

Closed honnorat closed 2 years ago

honnorat commented 5 years ago

Hi, many imports in pyroms source code suppose compiled fortran modules are in PYTHONPATH. Therefore, they can't be directly loaded by default:

>>> import pyroms
scrip.so not found. Remapping function will not be available
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/honnorat/usr/conda/envs/pyroms/lib/python3.7/site-packages/pyroms/__init__.py", line 20, in <module>
    from . import remapping
  File "/home/honnorat/usr/conda/envs/pyroms/lib/python3.7/site-packages/pyroms/remapping/__init__.py", line 18, in <module>
    from .flood import flood
  File "/home/honnorat/usr/conda/envs/pyroms/lib/python3.7/site-packages/pyroms/remapping/flood.py", line 4, in <module>
    import _remapping
ModuleNotFoundError: No module named '_remapping'

This PR replace abolute imports with relative imports (from pyroms import _remapping), which fixes the issue.