open and shut case

Erik Heneryd erik at heneryd.com
Mon Sep 27 16:22:12 CEST 2004


Dennis Lee Bieber wrote:
> On Sun, 26 Sep 2004 16:55:48 GMT, "Elaine Jackson"
> <elainejackson7355 at home.com> declaimed the following in
> comp.lang.python:
> 
> 
>>"Cameron Laird" <claird at lairds.us> wrote in message
>>news:nf1i22-7hd.ln1 at lairds.us...
>>| Did this [some snipped code] meet your needs, Ms. Jackson?
>>
>>Here's what it does:
>>
>>
>>>>>import os, win32api
>>>>>pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe",
>>
>>"iexplore.exe",r"c:\blabla\hej.html")
>>
>>Traceback (most recent call last):
>>  File "<pyshell#1>", line 1, in -toplevel-
>>    pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe",
>>"iexplore.exe",r"c:\blabla\hej.html")
>>AttributeError: 'module' object has no attribute 'spawnlp'
>>
> 
> 
> 	It seems the spawn family doesn't have the "search in PATH"
> option... os.execlp does exist, but likely doesn't do what you want
> either...
> 

It does, see http://docs.python.org/lib/os-process.html.
exec* replaces the current process, so you can't use that if you expect 
it to return.  I can't see why my code shouldn't work (though I'm not on 
a Windows box so I can't test it).


Erik



More information about the Python-list mailing list