How do I run an external system command on Windows?

noahspurrier at my-deja.com noahspurrier at my-deja.com
Tue Sep 19 12:26:35 EDT 2000


Does this mean that the "commands" module will work under Python2.0
and Windows? It seems odd commands forces the command to be run as
"{ cmd ; } 2>&1". I think it should be been an option, or an additional
method that returns a tuple with the stderr in it's own string.
Who maintains this? It would be great if this and other Expect-style
stuff worked the same under UNIX and NT.

Thanks for the info. Maybe I'll go become a beta pig and download 2.0b.

Yours,
Noah


In article <usnqxjp0q.fsf at ctwd0143.fitlinxx.com>,
  David Bolen <db3l at fitlinxx.com> wrote:
> In general, you can execute a command and retrieve it's output with
> the os.popen() function.  But prior to 2.0, if you want reliability
> under all Windows platforms and environments (console and graphical),
> you should use the win32pipe module from the Win32 extensions.  So if
> you want cross-platform with Python 1.5.2 (or I believe 1.6 as well)
> you should probably just check the platform, and select either
> os.popen() or win32pipe.popen() based on non-NT or NT.
>
> The win32pipe functionality has been rolled into the os.popen*()
> functions in Python 2.0, so with 2.0 you can just use the os module
> and be portable across platform.
>
> --
> -- David
> --
> db3l at fitlinxx.com  /


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list