Getting errors from popen in Windows

C

ChrisH

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
\Outlook\"'
outdata=''
proc = os.popen(strExec)
while 1:
line = proc.readline()
if line:
print line
outdata=outdata+line
else:
break


Thanks for the help,
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,209
Messages
2,571,088
Members
47,687
Latest member
IngridXxj

Latest Threads

Top