From: DeLano, W. <wa...@su...> - 2001-11-08 17:53:09
|
It looks like Andrey wants his script to be able to interpret command line arguments. Unfortunately, PyMOL doesn't enable this in a consistent way, since Launching under Windows (embedded Python) is quite different than unix (non-embedded Python). With embedded Python, arguments aren't making it to sys.argv. Instead, they are being passed straight from C into PyMOL's invocation routine. I will fix this in the next version by reassigning them to sys.argv, but you can do this immediate by inserting import sys sys.argv =3D copy.deepcopy(argv) Directly under "def parse_args(argv):" (line 79) in PyMOL/modules/pymol/invocation.py. =20 I'd also like to provide a means by which certain can be ignored by PyMOL and be available directly to Python scripts in PyMOL. Here is my proposal: =20 Ignore any arguments after a double-hyphen ("--") sentinel. For example: pymol -c myscript.py -- -pymol -will -ignore -these -arguments pymol -c myscript.py -- -your -script -interpret -them -instead Any objections?=20 - Warren -- mailto:wa...@su... Warren L. DeLano, Ph.D. Informatics Scientist Sunesis Pharmaceuticals, Inc. 341 Oyster Point Blvd. S. San Francisco, CA 94080 (650)-266-3606 fax: (650)-266-3501 > From: Frank Vondelft=20 >=20 > Andrey, >=20 > I deduce you're referring to windows? I think this is what=20 > you get when python gets installed in C:\Program Files\python=20 > or some other location that is not on the (hardcoded?) search=20 > path of pymol, which means it can't find the tcltk libraries.=20 > The solution is to install python on C:\python, and=20 > everything is hunky-dory -- I think you don't even have to=20 > reinstall pymol, but you can check that, it doesn't take long.=20 >=20 > Good luck > phx. >=20 > From: Andrey Khavryuchenko >=20 > Hi! >=20 > Is it only me who gets the following: >=20 > for i in argv: > print i >=20 > [...] >=20 > $ pymol -c mov.py > [...] > Hit ESC anytime to toggle between text and graphics. >=20 > Command mode. No graphics front end. > Traceback (most recent call last): > File "C:\Program Files\DeLano=20 > Scientific\PyMOL/modules\pymol\parser.py", lin > e 174, in parse > execfile(args[nest][0],pymol_names,pymol_names) > File "mov.py", line 90, in ? > for i in sys.argv: > AttributeError: 'sys' module has no attribute 'argv' > Memory: 0 blocks expected, 0 found, 42 maximum allocated. >=20 > Linux version and plain python under winnt are ok. It's only=20 > pymol that > gives that strange behaviour. >=20 > --=20 > Andrey V Khavryuchenko http://www.kds.com.ua/ > Offshore Software Development >=20 > _______________________________________________ > PyMOL-users mailing list > PyM...@li... > https://lists.sourceforge.net/lists/listinfo/pymol-users >=20 >=20 >=20 |