From UNIX to Win NT
Gordon McMillan
gmcm at hypernet.com
Mon Jul 3 10:57:28 EDT 2000
Thomas Thiele wrote:
>>
>> You've got both technical and cultural problems here. There is no
>> fork.
>
>I knew that. But I wonder how to start an other program. In UNIX I used
>fork() and exec().
>Just the same code like in popen2.popen3 but I copied the code and
>included some costumization.
>Does popen work on NT? Or is there an other way do get the same result
>(starting a program and
>read it's output)
All of the c runtime ways of starting processes have problems from annoying
to catastrophic on Windows. The best of the lot is probably os.execv.
os.popen works between well-behaved console processes on NT. If you want
fine-grained control (including dup'ing your file descriptors etc.), use
Win32process.CreateProcess from the Win32 extensions. Win32pipe.popen* use
it to emulate os.popen*.
But the real question is why are you doing this? While it's a common and
reasonably efficient way of doing things on *nix, it is both rare and very
expensive on Windows.
More information about the Python-list
mailing list