Re: Newbie - pass variable to cscript
On Tue, 03 Mar 2009 15:22:20 -, wrote: It's not firing off the vbs script. Have I got the syntax correct? Thanks. My latest attempt: vBS = "C:\\Program Files\\nasa\\nmail.vbs" os.system('cscript /from:wrk-...@pittcountync.gov / to:plsulli...@pittcountync.gov /sub:TEST /msg:hello ' + vBS) Your problem is that vBS has a space in it, so the Windows command interpreter is interpreting it as two separate arguments, r"C:\Program" and r"Files\nasa\nmail.vbs". Gabriel has already posted two solutions (which I won't repeat), but he forgot to mention the problem itself! -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie - pass variable to cscript
En Tue, 03 Mar 2009 13:22:20 -0200, escribió: On Mar 3, 10:07 am, "Gabriel Genellina" wrote: En Tue, 03 Mar 2009 12:19:22 -0200, escribió: > import os > os.system('cscript.exe /from:wrk-...@zzz.gov /to:plsulli...@zzz.gov' > "C:\\Program Files\\nasa\\nmail.vbs") > nmail.vbs works. I need to make it work from a python script. Thanks. ...and the problem is...? -- Gabriel Genellina It's not firing off the vbs script. Have I got the syntax correct? Thanks. My latest attempt: vBS = "C:\\Program Files\\nasa\\nmail.vbs" os.system('cscript /from:wrk-...@pittcountync.gov / to:plsulli...@pittcountync.gov /sub:TEST /msg:hello ' + vBS) Usually arguments come after the script name: vBS = "C:\\Program Files\\nasa\\nmail.vbs" os.system('cscript "%s" /from:wrk-...@pittcountync.gov /to:plsulli...@pittcountync.gov /sub:TEST /msg:hello' % vBS) But I'd use the subprocess module instead of os.system: import subprocess ret = subprocess.call(['cscript', vBS, '/from:...', '/to:...']) See http://docs.python.org/library/subprocess.html -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie - pass variable to cscript
On Mar 3, 10:07 am, "Gabriel Genellina" wrote: > En Tue, 03 Mar 2009 12:19:22 -0200, escribió: > > > import os > > os.system('cscript.exe /from:wrk-...@zzz.gov /to:plsulli...@zzz.gov' > > "C:\\Program Files\\nasa\\nmail.vbs") > > > nmail.vbs works. I need to make it work from a python script. Thanks. > > ...and the problem is...? > > -- > Gabriel Genellina It's not firing off the vbs script. Have I got the syntax correct? Thanks. My latest attempt: vBS = "C:\\Program Files\\nasa\\nmail.vbs" os.system('cscript /from:wrk-...@pittcountync.gov / to:plsulli...@pittcountync.gov /sub:TEST /msg:hello ' + vBS) -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie - pass variable to cscript
En Tue, 03 Mar 2009 12:19:22 -0200, escribió: import os os.system('cscript.exe /from:wrk-...@zzz.gov /to:plsulli...@zzz.gov' "C:\\Program Files\\nasa\\nmail.vbs") nmail.vbs works. I need to make it work from a python script. Thanks. ...and the problem is...? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list