manaakiwhenua / rhealpixdggs-py

rHEALPixdggs-py implements code to both define an rHEALPix DGGS Reference System and to perform topological queries on its Identfiers. Our roadmap is for v1.0 to be fully compliant with OGC Topic 21 v2.0 / ISO 19170-1:2020.
GNU Lesser General Public License v3.0
18 stars 4 forks source link

Using rhealpix fails with ModuleNotFoundError: No module named 'utils' #10

Closed aaime closed 9 months ago

aaime commented 4 years ago
python3 /tmp/test.py 
Traceback (most recent call last):
  File "/tmp/test.py", line 1, in <module>
    from rhealpixdggs import dggs, ellipsoids
  File "/home/aaime/.local/lib/python3.8/site-packages/rhealpixdggs/dggs.py", line 190, in <module>
    import rhealpixdggs.projection_wrapper as pw
  File "/home/aaime/.local/lib/python3.8/site-packages/rhealpixdggs/projection_wrapper.py", line 32, in <module>
    from rhealpixdggs.ellipsoids import WGS84_ELLIPSOID
  File "/home/aaime/.local/lib/python3.8/site-packages/rhealpixdggs/ellipsoids.py", line 32, in <module>
    from utils import my_round, auth_lat, auth_rad
ModuleNotFoundError: No module named 'utils'

Looking at the code, this might have been inadvertedly introduced by this change: https://github.com/manaakiwhenua/rhealpixdggs-py/commit/fd4e75a2bcc6830b7d82d7f1ef69603c3d7d6ed8#diff-a2956a387c73e7f966d2170d470d520fR32

I've also found out that "utils" is a public project on Pypi: https://pypi.org/project/utils/ (found it as I was looking around for this module). I've then realized it's a local class. In AusPIX the syntax is slightly different, "from .utils import...", see: https://github.com/GeoscienceAustralia/AusPIX_DGGS/blob/master/auspixdggs/auspixengine/ellipsoids.py#L27 Using this syntax works in my local tests.

rggibb commented 3 years ago

Yes definitely an inadvertant change as noted above.

wrt to the AusPix syntax of .utils rather than the more explicit rhealpixdggs.utils, I'll check best practice to see which is preferred.

alpha-beta-soup commented 9 months ago

The code consistently uses from rhealpixdggs.utils import ... now.