os.system commands in CGI on IIS?

Daniel Dittmar daniel at dittmar.net
Thu Dec 20 14:46:23 EST 2001


 > if I execute
 > os.system("copy c:\a.txt c:\b.txt")
 > It does not happen when the cgi page is called from a browser.
 > However if the script is run from the command line, it works fine.

In this specific case, you could use shutil.copy. In general, console 
applications (like cmd.exe) will not work inside a service or a GUI only 
program. You might try using the popen2 module, which possibly sets up 
stdin and stdout just right such that Windows doesn't need the console 
window. Setting the property 'may interact with desktop' for the IIS 
service might work as well, but you'll get annoying windows flashing 
across the screen.

Daniel




More information about the Python-list mailing list