Bug in os.popen* and win32pipe.popen*? (update)

Alan Miller ajm at enteract.com
Mon Apr 16 20:00:54 EDT 2001


Alan Miller (ajm at enteract.com) wrote:
>The specific symptom is that the process appears to hang, though it seems 
>like what's really happening is that w9xpopen or Win32popenwin9x grabs 
>the focus to a hidden window and expects some input.  [...]
>
>This is all on Win95 at the moment, I haven't had a chance to test it on 
>an NT box yet.

Update - this doesn't seem to be an issue on NT, and I assume that it's 
similarly not an issue on 2000 though I don't have convenient access to a 
2000 box with Python.

So, presumably there's something funky about the way pipes are called on 
Win95-based systems (may flow up through 98 & ME, see above comment).

Hmm, even more detail after tracking down the code for w9xpopen.exe: 
It looks like argv[1] gets passed to the CreateProcess API call, and a 
message box gets (theoretically) displayed if the number of arguments is 
not 2.  The message box presumably accounts for the loss of focus of the 
command window running Python and handling of command line arguments 
containing the standard delimiter character (") probably accounts for the 
reason to display that message box.

For people affected by this, it looks like it might be possible to work 
around this even within Python by using win32process.CreateProcess and 
bypassing the w9xpopen program completely (it doesn't do a huge amount).  
Alternatively, it might be reasonable to modify w9xpopen (and the 
ActiveState version) to only display the message box if there were no 
arguments and to otherwise pass everything except argv[0] to the 
CreateProcess API.

I'm not in a good position to make changes and test them directly; my 
potential test system and my potential compile system are ~16 miles 
apart and connected only by email, which makes for a mighty long compile-
test-fix cycle.

ajm



More information about the Python-list mailing list