Hi Jens, the "run" command is not identical to the python "import" statement. It does not search sys.path but takes an absolute or relative (from the current working directory) file name.
Both of these will work: PyMOL>run /opt/pymol/scripts/align_all.py PyMOL>import align_all See also: http://pymolwiki.org/index.php/Run http://pymolwiki.org/index.php/Pwd Cheers, Thomas Thomas, Jens wrote, On 02/12/13 10:47: > Hi, > > I'm trying to run the align_all.py script > (http://pldserver1.biochem.queensu.ca/~rlc/work/pymol/align_all.py) in > PyMol running on Linux. > > I've put the script in /opt/pymol/scripts, and in my .pymolrc file, I > have the following: > > sys.path.append("/opt/pymol/scripts") > > and if I print sys.path in the pymol command line, I get the following: > > PyMOL>print sys.path > ['', '/opt/pymol/modules', > '/opt/pymol/ext/lib/python2.5/site-packages/setuptools-0.6c7-py2.5.egg', > '/opt/pymol/ext/lib/python2.5/site-packages/simplejson-2.0.5-py2.5-linux-i686.egg', > '/opt/pymol/ext/lib/python25.zip', '/opt/pymol/ext/lib/python2.5', > '/opt/pymol/ext/lib/python2.5/plat-linux2', > '/opt/pymol/ext/lib/python2.5/lib-tk', > '/opt/pymol/ext/lib/python2.5/lib-dynload', > '/opt/pymol/ext/lib/python2.5/site-packages', '/opt/pymol/scripts'] > > However, if I try running the script, I get the following: > > PyMOL>run align_all.py > Traceback (most recent call last): > File > "/home/vertrees/work/products/pymol/edu_build/dist/pymol/./modules/pymol/parser.py", > line 338, in parse > File "/opt/pymol/modules/pymol/parsing.py", line 455, in run_file > execfile(file,global_ns,local_ns) > IOError: [Errno 2] No such file or directory: 'align_all.py' > > If I run the full path to the script it works: > > PyMOL>run /opt/pymol/scripts/align_all.py > > And I can then use the command. > > Is there any obvious reason why it's not looking in the > /opt/pymol/scripts directory, even when this is in the sys.path? > > Thanks, > > Jens -- Thomas Holder PyMOL Developer Schrödinger Contractor ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb _______________________________________________ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net