displaying properly formatted output of ipconfig.exe

Joe Flynt joe.flynt at mail.portland.co.uk
Sat Nov 8 17:49:44 EST 2003


I'm try to display the output of ipconfig.exe to the web browser
using:
Apache/2.0.48 (Win32) mod_python/3.1.2b Python/2.3.2

but when I view http://server/cgi-bin/test.py i get the following
format of output:
['\r\n', 'Windows IP Configuration\r\n', '\r\n',
etc.

How do I get it to display the same output as if I had executed the
program in cmd.exe?

This is the source of test.py:

#!C:\Python23\python.exe
import os
print "Content-type: text/html\r\n\r\n"
cmdpipe = os.popen("ipconfig","r")
lines = cmdpipe.readlines()
print lines




More information about the Python-list mailing list