Getting errors from popen in Windows

Tim Golden tim.golden at viacom-outdoor.co.uk
Mon Oct 25 11:55:47 EDT 2004


[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\"'

[... snip rest of code ...]

I'll leave others to comment on popen; I would just point
out that there are easier and perhaps more rubust ways to
copy a file under Win32. Perhaps you were just using this
as a simple example, in which case ignore this post. But
just in case, check out copyfile in the shutil module, or
CopyFile in win32file.

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-list mailing list