Yes! This has worked. Thanks Thomas.


2013/12/5 Thomas Holder <speleo3@users.sourceforge.net>
Hi David,

incentive pymol builds have the python interpreter and the _cmd module built into the pymol.exe executable. This means running the script with your system python is not supported. Instead, run your script with pymol, without the GUI, like this:

/opt/soft/pymol-v1.5.0.3/pymol -cqr script.py

Hope that helps.

Cheers,
  Thomas

On 05 Dec 2013, at 06:26, David McGiven wrote:
> Dear PyMOL Users,
>
> I am trying to run some pymol functions from a python script. For simplicity purposes, the script is called "script.py" and it's as simple as this :
>
> #cat script.py
> import pymol
> #
>
> Then I run it like this :
>
> #export PYMOL_PATH=/opt/soft/pymol-v1.5.0.3
> #export PYTHONPATH=/opt/soft/pymol-v1.5.0.3/modules
> #python script.py
> Traceback (most recent call last):
>   File "py.py", line 1, in <module>
>     import pymol
>   File "/opt/soft/pymol-v1.5.0.3/modules/pymol/__init__.py", line 473, in <module>
>     import _cmd
> ImportError: No module named _cmd
>
> I don't understand why is it giving this error. I am running CentOS 6.2. I have edited $PYMOL_PATH/modules/pymol/__init.py__ and checked the instructions on the top of the file. It says :
> # THE SUPPORTED WAY:
>
> # "python pymol/__init__.py" in an environment in which $PYMOL_PATH
> # points to the main PyMOL directory and $PYTHONPATH includes
> # $PYMOL_PATH/modules or where the contents of $PYMOL_PATH/modules
> # have been installed in a standard location such as
> # /usr/lib/python2.1/site-packages
>
> Well, this isn't working for me.
>
> Could someone please provide some help ?
>
> Thanks.