petsc4py doesn't import with caught warnings
Issue #109
resolved
Importing petsc4py with python -W error
fails:
[pefarrell@aoibheann:~]$ python -W error -c "from petsc4py import PETSc"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/pefarrell/local/firedrake/firedrake-dev-20180726/lib/python3.6/site-packages/petsc4py/PETSc.py", line 3, in <module>
PETSc = ImportPETSc(ARCH)
File "/home/pefarrell/local/firedrake/firedrake-dev-20180726/lib/python3.6/site-packages/petsc4py/lib/__init__.py", line 29, in ImportPETSc
return Import('petsc4py', 'PETSc', path, arch)
File "/home/pefarrell/local/firedrake/firedrake-dev-20180726/lib/python3.6/site-packages/petsc4py/lib/__init__.py", line 47, in Import
import sys, os, imp, warnings
File "/usr/lib/python3.6/imp.py", line 33, in <module>
DeprecationWarning, stacklevel=2)
DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
Comments (3)
-
-
@pefarrell I didn't hear your feedback, I'll assume this issue is fixed.
-
- changed status to resolved
- Log in to comment
I pushed a workaround (basically, ignore the warning) in 4d7d7f6. I'm not ready yet for a proper fix using the
importlib
module in Python 3, I do not know the details yet, and I would need different code for Python 3.3 (though I guess that such an old Py 3 version could be just declared unsuported).@pefarrell Could you please give it a quick test on your side, and then close this issue if things work as expected?