passing a variable to an external program

Rich richfahey at gmail.com
Thu Jan 11 20:10:37 CET 2007


I want to run an external program using os.system() but I want to
include a variable in the middle of the command line.

An example of the type of thing I want to be able to do:
pathname = os.path.dirname(sys.argv[0])
os.system('cscript /nologo ' + pathname + '\test.vbs')

When I run this, everything after pathname + seems to be ignored.  Is
this just incorrect syntax or am I trying to do something fundamentally
wrong?  Is there a better way to do something like this?  I'm trying to
move from perl to python and this is my first attempt at python.




More information about the Python-list mailing list