On 25/10/2011 08:01, Propad wrote:
Thnx again for all the answers. As stated before, I'm limited in my options. One of them just might be to switch to Python 2.5, rewrite the code that crashes using the subprocess module, and then somehow patch the library I use (which I'm not suposed to do, but... oh well :-)). I can just hope subrocess was already mature adn offering the relevant functionality in 2.5.
I must admit I'm more than slightly surprised by this. My test case is to use os.spawnl to run c:/windows/notepad.exe. From the docs, I would expect to use os.spawnl (os.P_WAIT, "c:/windows/notepad.exe"). (I only want to open notepad.exe; there's no need for additional args). These are my test cases: (1) os.spawnl ( os.P_WAIT, "c:/windows/notepad.exe" ) (2) os.spawnl ( os.P_WAIT, "c:/windows/notepad.exe", "c:/windows/notepad.exe" ) (3) os.spawnl ( os.P_WAIT, "c:/windows/notepad.exe", "c:/windows/notepad.exe", "c:/temp.txt" ) And the results: ============================================================== Python | Platform | Case | Result -------------------------------------------------------------- 2.2.2 | WinXP | 1 | Works (empty notepad) 2.2.2 | WinXP | 2 | Works (empty notepad) 2.2.2 | WinXP | 3 | Works (notepad temp.txt) -------------------------------------------------------------- 2.2.2 | Win7 | 1 | OSError 2.2.2 | Win7 | 2 | Works (empty notepad) 2.2.2 | Win7 | 3 | Works (notepad temp.txt) -------------------------------------------------------------- 2.7.2 | WinXP | 1 | Crashes 2.7.2 | WinXP | 2 | Works (empty notepad) 2.7.2 | WinXP | 3 | Works (notepad temp.txt) -------------------------------------------------------------- 2.7.2 | Win7 | 1 | Crashes 2.7.2 | Win7 | 2 | Works (empty notepad) 2.7.2 | Win7 | 3 | Works (notepad temp.txt) ============================================================== Add to this a look at the mscrt source which ships with VS 2008 and the MSDN docs for spawnl: http://msdn.microsoft.com/en-us/library/wweek9sc%28v=vs.80%29.aspx and we see that the first args parameter must be the same as the path parameter. FWIW, at no extra cost, I went to the trouble of testing it on some flavour of Linux with Python 2.6 and got the same results as per 2.2.2 on WinXP. (Basically: everything works). Which leaves us with http://bugs.python.org/issue8036 in which recent versions of Python crash when the (arbitrary) second parameter isn't passed. And with an inexplicable behaviour change between the same version of Python running on WinXP and on Win7. It looks as though the workaround for your problem (or, possibly, your failure to fulfil some artificial parameter requirements) is to add the executable again as the third parameter. issue8036 (which also affects the execl family) has a patch waiting for review, which hopefully we can get round to fixing. As far as I can tell, the execl/spawnl family of functions isn't currently represented in the testsuite. TJG -- http://mail.python.org/mailman/listinfo/python-list