On Tue, Apr 16, 2013 at 7:14 AM, PEnergy <prqu...@gmail.com> wrote:
> Greetings,
>
> I am trying to write a python script that, when called from the DOS prompt, 
> will call another python script and pass it input variables.  My current code 
> will open the other python script but doesn't seem to pass it any values:
>
> import os,sys,subprocess
> subprocess.Popen(['python.exe','C:\NDEX\GRE2\uip\uip_20.py','t3c*'])
>
> Am I missing something or is this type of call not possible through DOS?

1. Backslash is an escape character in Python strings (e.g. "\n" =
newline). You should therefore double-up on your backslashes. (Your
exact string just so happens to work due to a misfeature regarding how
invalid backslash escapes are handled.)
2. Glob/wildcard ("*") expansion is done by the shell, but
subprocess.Popen does not use the shell by default (for good reason!).
Use the `glob` library to do the expansion yourself, in Python:
http://docs.python.org/2/library/glob.html

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to