Skip to content

Draft: Fix python module __init__.py

Figured out how to build and install py2geom, but it would fail including for me:

$ python
Python 3.11.5 (main, Sep  2 2023, 14:16:33) [GCC 13.2.1 20230801] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import py2geom
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.11/site-packages/py2geom/__init__.py", line 26, in <module>
    from py2geom._py2geom import *
ImportError: lib2geom.so.1.1.0: cannot open shared object file: No such file or directory
>>> 

My interpretation is that because I try to import py2geom and in doing so the interpreter locates the package directly and runs the __init__.py, the statement from py2geom._py2geom import * doesn't make sense – the file is already in the py2geom package. Changing it to from _py2geom import * makes it work for me.

Please double check if this isn't only one of more use cases for this file and merging this would break another; I am not familiar with layout and intentions of this library yet.

Merge request reports