On 4 September 2013 11:42, eryksun <eryk...@gmail.com> wrote:
>>>     si = subprocess.STARTUPINFO()
>>>     si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
>>>     si.wShowWindow = subprocess.SW_HIDE
>>
>> Do these statements modify module-level state? Or do you need to pass
>> startupinfo=si when calling Popen?
>
> It's a documented option for instances of Popen, to configure a few
> fields in the STARTUPINFO struct that gets passed to CreateProcess.

It's not clear from the docs (or your explanation) whether the lines
above modify a global STARTUPINFO struct that gives default behaviour
to subprocesses or if it is just the way to initialise one that can be
passed to Popen or the convenience APIs. I guess the latter in which
case it's probably better to be explicit and say:

si = subprocess.STARTUPINFO()
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
si.wShowWindow = subprocess.SW_HIDE
subprocess.check_call(cmdargs, startupinfo=si)


Oscar
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to