Capture DOS error???

Stan Cook scook at elp.rr.com
Thu Jun 19 23:04:19 EDT 2003


On 19 Jun 2003 12:29:35 +0200, Syver Enstad <syver at inout.no> wrote:

> "Stan Cook" <scook at elp.rr.com> writes:
>
>> 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)
>
> Would this help:
> errorlevel = os.system(shellCmd)
> if errorlevel != 0:
> # do error stuff here

Thanks!  That was perfect.  I originally was expecting the output to be a 
string, but soon worked it all out.

Thanks again

-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/




More information about the Python-list mailing list