Hi, I'm using PyMOL as a front end to a few scripts. So, I need to get my hands on sys.argv to process the command-line arguments. On OS X, everything works just like I'd expect. However, on Linux, I can't get sys.argv. Here's a very simple Python script:
#!/usr/bin/env python import sys print dir(sys) print sys.argv When I run pymol -cr ./my_script.py on Linux, I get this: PyMOL>run ./x.py,main ['__displayhook__', '__doc__', '__excepthook__', '__name__', '__stderr__', '__stdin__', '__stdout__', '_getframe', 'api_version', 'builtin_module_names', 'byteorder', 'call_tracing', 'callstats', 'copyright', 'displayhook', 'exc_clear', 'exc_info', 'exc_type', 'excepthook', 'exec_prefix', 'executable', 'exit', 'exitfunc', 'getcheckinterval', 'getdefaultencoding', 'getdlopenflags', 'getfilesystemencoding', 'getrecursionlimit', 'getrefcount', 'hexversion', 'maxint', 'maxunicode', 'meta_path', 'modules', 'path', 'path_hooks', 'path_importer_cache', 'platform', 'prefix', 'setcheckinterval', 'setdlopenflags', 'setprofile', 'setrecursionlimit', 'settrace', 'stderr', 'stdin', 'stdout', 'version', 'version_info', 'warnoptions'] Traceback (most recent call last): File "/users/mlerner/src/pymol/modules/pymol/parser.py", line 287, in parse parsing.run_file(exp_path(args[nest][0]),__main__.__dict__,__main__.__dict__) File "/users/mlerner/src/pymol/modules/pymol/parsing.py", line 407, in run_file execfile(file,global_ns,local_ns) File "./x.py", line 4, in ? print sys.argv AttributeError: 'module' object has no attribute 'argv' PyMOL: normal program termination. While pawing around in the PyMOL sources, I found that pymol_argv shows up. It seems to be what I want, but I don't know how stable it is. Am I supposed to use it instead of sys.argv? Thanks, -michael -- Biophysics Graduate Student Carlson Lab, University of Michigan http://www.umich.edu/~mlerner