[Python-Dev] deprecate commands.getstatus()

Michael Foord fuzzyman at voidspace.org.uk
Thu Mar 22 22:53:32 CET 2007

Titus Brown wrote:
> On Thu, Mar 22, 2007 at 09:34:46PM +0000, Michael Foord wrote:
> -> Guido van Rossum wrote:
> -> > Sure. os.fork() and the os.exec*() family can stay. But os.spawn*(),
> -> > that abomination invented by Microsoft? I also hear no opposition
> -> > against killign os.system() and os.popen()
> -> 
> -> Except that 'os.system' is really easy to use and I use it rarely enough 
> -> that I *always* have to RTFM for subprocess which makes you jump through 
> -> a few more (albeit simple) hoops.
> Hopefully the patch I'm making will change that, no?
> I could add in a 'system'-alike call easily enough; that was suggested.
> But I think
> 	returncode = subprocess.call("program")
> is pretty simple, isn't it?
Probably. I can just never remember it (I didn't remember it when typing 
that email). My fault, os.system is just easier to remember - make an os 
system call. :-)

> -> Additionally, AFAIK subprocess is still broken for py2exe'd applications 
> -> which is a problem.
> Explain?
Programs created with py2exe (or frozen in other ways I believe - 
including the Wing IDE for example), fail with an error similar to the 
following :

Traceback (most recent call last):
   File "main.py", line 133, in <module>
   File "main.py", line 125, in main
   File "main.py", line 98, in launch_launcher
     subprocess.Popen([path], stderr = childstderr)
   File "subprocess.pyc", line 586, in ___init___
   File "subprocess.pyc", line 681, in _get_handles
   File "subprocess.pyc", line 722, in _make_inheritable
TypeError: an integer is required

The problem is detailed here :


"if you used py2exe to create a Windows program as opposed to a console 
program, and you launched the py2exe program by clicking rather than by 
running if from a command window, then the parent process has no handle 
to inherit. subprocess.Popen will throw an exception (TypeError: an 
integer is required) because GetStdHandle returns None"

(Although the workaround as listed there is reported not to work and I 
haven't put the effort into experimenting.)

If subprocess is supposed to be the main way that users launch 
sub-processes it would be nice if it worked for py2exe without the users 
(who are often newbies) having to put a workaround in place.

Currently of course 'os.system' is often sufficient workaround. :-)

All the best,

Michael Foord

> cheers,
> --titus

More information about the Python-Dev mailing list