En Tue, 18 Mar 2008 07:09:08 -0300, <[EMAIL PROTECTED]> escribió:

> On Mar 17, 8:16 pm, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
>> On 17 mar, 19:43, [EMAIL PROTECTED] wrote:
>>
>> > Can I allocate a second console window, so I can place certain output
>> > to that directly, and leave the original streams alone?  I tried

>> Have you tried using the creationflags argument to subprocess.Popen?
>> Specially the CREATE_NEW_CONSOLE flag. See the Microsoft documentation
>> for CreateProcess  
>> athttp://msdn2.microsoft.com/en-us/library/ms682425(VS.85).aspx
>> (Note that a process can be attached at most to one console)
>>
> One console per process is fine, but I tried using 'cmd.exe',
> 'cmd.exe /K', and 'more.com' (fully specified in c/windows/system32)
> as separate processes.  The sign is the console window splashes up and
> vanishes right away.

Apparently you have to either redirect stdout AND stdin, or none of them.  
This worked for me:

p = subprocess.Popen('c:\\windows\\system32\\cmd.exe',
         stdout=subprocess.PIPE, stdin=subprocess.PIPE,
         creationflags=subprocess.CREATE_NEW_CONSOLE)
p.communicate("dir\n")

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to