del on os.environ?
Alex Martelli
aleax at aleax.it
Tue Sep 11 05:38:07 EDT 2001
"Peter Seibel" <peter at javamonkey.com> wrote in message
news:m3zo829rw1.fsf at localhost.localdomain...
...
> And the whole exec*/spawn* suite of functions, seem fraught with non-
> or dubious- portability. But maybe I'm just being a chicken.Both exec*
> and spawn* are listed as both Unix and Windows; is that really true,
> i.e. do they really work the same on both platforms?. And I can't
Yes, in as much as I was able to test -- identical behavior on
Linux, OpenBSD, Win98, and Win/NT, on all of my test-cases.
> really use exec* on Windows because fork() isn't supported, right?
Right -- unless you run Python on Cygwin, which does a heroic
job emulating fork (works fine, too -- but, forget about any
performance hopes, of course:-).
On Unix-ish platforms, it's not too hard to tweak a copy of
popen2.py to use execvpe instead of execvp (not elegant,
but it should work, e.g. by extending class Popen3 and
overriding its private method _run_child). Harder by far
for Windows, where one would have to hack the guts of
posixmodule.c and maybe w9xpopen.c too if it's still
around -- definitely unfeasible.
Given the unfortunate nonstandard status of unsetenv,
I think [at least some of] the popen* calls should
probably accept an optional argument to let you control
the environment of the child process. Maybe you can
submit it to sourceforce as a small feature request...
in the meantime, I think you may need to dig into
win32all to implement your own "popen with child
environment control":-(
Alex
More information about the Python-list
mailing list