Somewhere between python2.7-minimal 2.7.3 (used in the virtual machine) and 2.7.5 (in debian unstable) /usr/lib/python2.7/tempfile.py, which is imported in $CLAW/python/pyclaw/util.py, started importing the python "io" builtin. This causes execution of $CLAW/python/pyclaw/runclaw.py from the unix shell to fail (see output below) as it appears to incorrectly resolve "io" as $CLAW/python/pyclaw/io/init.py.
Two alternative fixes:
- move runclaw.py (and any other "executables") out of the pyclaw module directory so that the only way to import pyclaw.io is "import pyclaw.io", thus avoiding the namespace collision.
- in runclaw.py (and other "executables") remove $CLAW/python/pyclaw from the path before importing pyclaw.
$ (cd $CLAW/apps/advection/1d/example1;make output)
python /home/kevmitch/projects/clawpack-4.x/python/pyclaw/runclaw.py xclaw _output True False
Traceback (most recent call last):
File "/home/kevmitch/projects/clawpack-4.x/python/pyclaw/runclaw.py", line 77, in
runclaw(*args)
File "/home/kevmitch/projects/clawpack-4.x/python/pyclaw/runclaw.py", line 33, in runclaw
from pyclaw.controller import Controller
File "/home/kevmitch/projects/clawpack-4.x/python/pyclaw/init.py", line 24, in
from pyclaw.controller import Controller
File "/home/kevmitch/projects/clawpack-4.x/python/pyclaw/controller.py", line 35, in
from solution import Solution
File "/home/kevmitch/projects/clawpack-4.x/python/pyclaw/solution.py", line 24, in
import io
File "/home/kevmitch/projects/clawpack-4.x/python/pyclaw/io/init.py", line 12, in
from ascii import read_ascii,write_ascii
File "/home/kevmitch/projects/clawpack-4.x/python/pyclaw/io/ascii.py", line 22, in
from pyclaw.util import read_data_line
File "/home/kevmitch/projects/clawpack-4.x/python/pyclaw/util.py", line 27, in
import tempfile
File "/usr/lib/python2.7/tempfile.py", line 32, in
import io as _io
File "/home/kevmitch/projects/clawpack-4.x/python/pyclaw/io/init.py", line 12, in
from ascii import read_ascii,write_ascii
File "/home/kevmitch/projects/clawpack-4.x/python/pyclaw/io/ascii.py", line 22, in
from pyclaw.util import read_data_line
ImportError: cannot import name read_data_line
make: *** [output] Error 1