Capture DOS error???

Syver Enstad syver at inout.no
Thu Jun 19 12:29:35 CEST 2003


"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 




More information about the Python-list mailing list