Swig generated modules use relative imports which fails with python 3
Issue #363
resolved
There's a bug in swig which makes it tricky to fix this the 'right way', and @johanhake has submitted a patch to swig fixing that bug.
The error looks like this:
Traceback (most recent call last):
File "test.py", line 30, in <module>
from dolfin import has_mpi, has_parmetis, has_scotch, has_linear_algebra_backend
File "/home/buildbot/fenicsbbot/next/dolfin-full/lib/python3.4/site-packages/dolfin/__init__.py", line 16, in <module>
from . import cpp
File "/home/buildbot/fenicsbbot/next/dolfin-full/lib/python3.4/site-packages/dolfin/cpp/__init__.py", line 42, in <module>
exec("from . import %s" % module_name)
File "<string>", line 1, in <module>
File "/home/buildbot/fenicsbbot/next/dolfin-full/lib/python3.4/site-packages/dolfin/cpp/la.py", line 111, in <module>
import common
ImportError: No module named 'common'
@johanhake: since you apparently know a way to hack around this problem for now, can you apply that fix? All dolfin/py3 work so far is now in master.
Comments (5)
-
-
For the record this is the upstream bug report and this is the proposed fix.
-
The proposed fix is now in upstream SWIG master and will be available with the next release of SWIG, i.e. 3.0.3.
-
- changed status to resolved
I mark this as resolved as it is fixed in DOLFIN.
-
- removed milestone
Removing milestone: 1.5 (automated comment)
- Log in to comment
Yes, I can take a look at it tomorrow.