python parser overridden by pymol

Robert Kern robert.kern at gmail.com
Fri Nov 13 03:32:32 CET 2009


Jeremiah H. Savage wrote:

> To use pymol and numpy together, I now do the following:
> 
> To ~/.bashrc add:
>         PYMOL_PATH=/usr/lib/pymodules/python2.5/pymol
>         export PYMOL_PATH
> 
> Then I can do the following in python:
> 
>      import numpy
>      numpy.save('123',numpy.array([1,2,3]))
>      numpy.load('123.npy')
>            array([1, 2, 3])
>      import sys
>      sys.path.append( "/usr/lib/pymodules/python2.5/pymol")
>      import pymol
>      pymol.finish_launching()
>      pymol.importing.load("/path/to/file.pdb")

No, do not do this. Add /usr/lib/pymodules/python2.5/ to your $PYTHONPATH, *not* 
/usr/lib/pymodules/python2.5/pymol/. You will continue to run into problems if 
you do it this way. You are not supposed to put the directory *of* the package 
onto sys.path but rather the directory that *contains* the package directory.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list