Being new to python scripting, I am facing a simple problem.
I am writing a python script "MyScript.py" in which I am calling the third-part program PyMOL through the import function.
Here is the simplified script (mainly inspired from this blog: http://doeidoei.wordpress.com/2009/02/11/pymol-api-simple-example/)
#! /usr/bin/python # Usage: MyScript.py <input> # launch PyMOL from the terminal import __main__ __main__.pymol_argv = [ 'pymol', '-qc'] import sys import pymol pymol.finish_launching() # Input file = sys.argv #run PyMOL command pymol.cmd.do("load %s" % file) #Exit PyMOL pymol.cmd.quit()
I get this error message:
Traceback (most recent call last): File "./MyScript.py", line 10, in <module> import pymol ImportError: No module named pymol
* My path to Python site-packages:
* My path to PyMOL:
(I made an alias pymol='MacPyMOL' in .bash_profile)
* I also tried to replace in the script:
import sys import pymol
import sys sys.path.append("/Users/me/my_apps/MacPyMOL_1.3.app/Contents/MacOS") import MacPyMOL
but still the same.
I looked at other forums but it didn't solve the problem:
If someone could direct me to a solution...