Getting errors from popen in Windows

ChrisH secun at
Mon Oct 25 17:51:10 CEST 2004

Is there a way in python to run a DOS command and have it return any errors that occur? I've 
tried some of the different versions of peopen as well as the code listed below and none of 
them give me the error that is displayed when I run the command from a prompt.

(Python 2.3, win32all, Windows NT/2K/XP)

strExec = 'copy "z:\MS Exchange Settings.NK2" "%USERPROFILE%\Application Data\Microsoft
    proc = os.popen(strExec)
    while 1:
        line = proc.readline()
        if line:
            print line

Thanks for the help,

More information about the Python-list mailing list