faqts : Computers : Programming : Languages : Python : Snippets

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 6 people (100%) answered Yes
Recently 3 of 3 people (100%) answered Yes

Entry

How do I shell-out on Win32 systems with Python?

Jul 5th, 2000 10:01
Nathan Wallace, Hans Nowak, Snippet 180, Arpad Kiss


"""
Packages: operating_systems.windows
"""
"""
> I know that on Unix systems you can use the commands  or the popen
> modules.
> 
> What do I have to do to get the output from a command (like 'dir', or a
> batch file) executed on a Win32 system?
Try to use the win32pipe modul! Here is an example:
"""
import win32pipe
i,o,e=win32pipe.popen3("dir")
pout=o.readlines()
perr=e.readlines()
# ....