Hi
how do I determine the path of the script???
the answer is sys.argv[0]
for more information see this page
http://diveintopython.org/functional_programming/finding_the_path.html
PS sorry for the mistake Jason Vertrees
--
Yerko Ignacio Escalona Balboa
Ingeniero en Biotecnología Molecular
I think you'll be saddened to discover that if you try what Petr (the
original poster) was doing, sys.argv[0] won't work.
$ cat test.py
print sys.argv[0]
$ pymol -qrc test.py
PyMOLrun test.py,main
/sw/lib/pymol-py26/modules/pymol/__init__.py
This quite clearly gives the behavior that Petr had
Dear Mr. Hall,
thank you very much for your help. This really works (I have tested it
now on windows).
Regards,
Petr Benes
2010/4/15 David Hall li...@cowsandmilk.net:
I think you'll be saddened to discover that if you try what Petr (the
original poster) was doing, sys.argv[0] won't work.
$
Dear pyMol users,
I am developing a python script for pyMol. If a user clicks File-Run
and selects the script (for example c:/test/myScript.py), how do I
determine the path of the script, i.e. (c:/test/) from inside the
running script?
I tried various python possibilities
Petr,
This is a cool problem treading on the grounds of PyMO/Python/System
integration. You could create a wrapper function that takes the
absolute path to the file, then chdir to the directory with the file,
and import the file. Once you os.chdir somewhere, cmd.pwd() should
return the new