-
Notifications
You must be signed in to change notification settings - Fork 299
Closed
Labels
Description
Description of the problem
For mintpy installed in the editable mode using pip, when there is a folder named mintpy in the current data directory, Python would misidentify the mintpy folder as the module location; and result in a TypeError while running, as shown in the example commands below. Any idea how to fix this?
This only happens when mintpy is installed via pip install -e option; while regular pip install and conda install versions work fine.
Full script that generated the error
(insar) yunjunz:~/data/test/FernandinaSenDT128/mintpy>$ python -c "import mintpy; print(mintpy.__file__, mintpy.__path__)"
(insar) yunjunz:~/data/test/FernandinaSenDT128>$ python -c "import mintpy; print(mintpy.__file__, mintpy.__path__)"
(insar) yunjunz:~/data/test/FernandinaSenDT128>$ view.py mintpy/velocity.h5
Full error message
(insar) yunjunz:~/data/test/FernandinaSenDT128/mintpy>$ python -c "import mintpy; print(mintpy.__file__, mintpy.__path__)"
/Users/yunjunz/tools/MintPy/mintpy/__init__.py ['/Users/yunjunz/tools/MintPy/mintpy']
(insar) yunjunz:~/data/test/FernandinaSenDT128>$ python -c "import mintpy; print(mintpy.__file__, mintpy.__path__)"
None _NamespacePath(['/Users/yunjunz/data/test/FernandinaSenDT128/mintpy', '/Users/yunjunz/data/test/FernandinaSenDT128/mintpy'])
(insar) yunjunz:~/data/test/FernandinaSenDT128>$ view.py mintpy/velocity.h5
Traceback (most recent call last):
File "/Users/yunjunz/tools/miniconda3/envs/insar/bin/view.py", line 8, in <module>
sys.exit(main())
File "/Users/yunjunz/tools/MintPy/mintpy/cli/view.py", line 166, in main
from mintpy.view import viewer
File "/Users/yunjunz/tools/MintPy/mintpy/view.py", line 26, in <module>
from mintpy.utils import plot as pp, ptime, readfile, utils as ut
File "/Users/yunjunz/tools/MintPy/mintpy/utils/plot.py", line 22, in <module>
from mintpy.objects.colors import ColormapExt
File "/Users/yunjunz/tools/MintPy/mintpy/objects/colors.py", line 24, in <module>
MINTPY_CPT_DIR = os.path.join(os.path.dirname(mintpy.__file__), 'data', 'colormaps')
File "/Users/yunjunz/tools/miniconda3/envs/insar/lib/python3.8/posixpath.py", line 152, in dirname
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
System information
- Operating system: macOS
- Python environment: conda for dependencies, pip for mintpy
- MintPy version: 1.4.1-29, date 2022-10-31
Reactions are currently unavailable