pymol vs numpy conflict
Hello,
I'm fairly new to python (2.5.4-2), and am writing a program which
uses both pymol (1.2r1-3) and numpy (1:1.3.0-3) from unstable.
The situation is that I have a large numpy array which takes an hour
to generate. Therefore, I'd like to use numpy.save() and then
numpy.load() so I could just generate the first time the program runs,
and then load it later as needed.
I've successfully tested the use of numpy.save() and numpy.load() with
a small example:
>>> import numpy
>>> numpy.save('123',numpy.array([1,2,3]))
>>> numpy.load('123.npy')
array([1, 2, 3])
However, a problem arises when I attempt to use pymol in the same
program. First, to use the pymol api, I add the following to
~/.bashrc:
PYMOL_PATH=/usr/lib/pymodules/python2.5/pymol
export PYMOL_PATH
PYTHONPATH=$PYMOL_PATH
export PYTHONPATH
But once this is done, numpy.load() no longer works correctly:
>>> numpy.load('123.npy')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/numpy/lib/io.py", line 195, in load
return format.read_array(fid)
File "/usr/lib/python2.5/site-packages/numpy/lib/format.py",
line 353, in read_array
shape, fortran_order, dtype = read_array_header_1_0(fp)
File "/usr/lib/python2.5/site-packages/numpy/lib/format.py",
line 250, in read_array_header_1_0
d = safe_eval(header)
File "/usr/lib/python2.5/site-packages/numpy/lib/utils.py", line
840, in safe_eval
ast = compiler.parse(source, "eval")
File "/usr/lib/python2.5/compiler/transformer.py", line 54, in parse
return Transformer().parseexpr(buf)
File "/usr/lib/python2.5/compiler/transformer.py", line 133, in parseexpr
return self.transform(parser.expr(text))
AttributeError: 'module' object has no attribute 'expr'
I've seen where someone else has had a similar problem
http://groups.google.com/group/genshi/browse_thread/thread/05ae0216b01dced8
and the listed cause is a file "parser.py"
There is a file /usr/lib/pymodules/python2.5/pymol/parser.py so this
is probably the cause.
How should I deal with this? Should I rename .../pymol/parser.py and
all references to it?
Thanks,
Jeremiah
Reply to: