469,328 Members | 1,316 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,328 developers. It's quick & easy.

Getting errors from popen in Windows


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
Jul 18 '05 #1
0 1042

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Stuart McGraw | last post: by
3 posts views Thread by Bolin | last post: by
16 posts views Thread by Chris Maloof | last post: by
2 posts views Thread by Greg Ercolano | last post: by
25 posts views Thread by Jeremy Banks | last post: by
1 post views Thread by Mark Shewfelt | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.