Capture DOS error???

Stan Cook scook at elp.rr.com
Thu Jun 19 01:41:34 EDT 2003


I'm writing a script which at some point will map to a list of servers.  The
program will be keeping a log of problems it encounters to be reviewed
later. To map the drive, I am using:

sDrive =
["B","F","G","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X"
,"Y","Z"]
iIndex = 0
shellCmd = ""
    for s in sImage:  # list of servers
        shellCmd =  "map " + sDrive[iIndex] + ":=" + s
        iIndex=iIndex + 1
        os.system(shellCmd)

My question is this...Is there a way to capture the DOS error it would
display if it had a problem mapping the server?  I want to detect the
exception if there is one and write it to the log file.  I have tried using
OSError, SystemError, and StandardError without success.  I'm not
necessarily looking for someone to write the code for me as much as pointing
me in the right direction.

Thanks,








More information about the Python-list mailing list