Pythonwin break execution

Alex Martelli aleaxit at yahoo.com
Mon Apr 9 09:18:50 EDT 2001


"Steve Holden" <sholden at holdenweb.com> wrote in message
news:06hA6.126963$m04.5158561 at e420r-atl1.usenetserver.com...
    [snip]
> An integer argumnet (usually from 0-127) is returned as the completion
> status of the process under Unices, but Windozes tend to be a little less
> cooperative.

How so?  The old and obsolete .BAT interpreter only affords ugly
ways to TEST completion status (if errorlevel, bah), but the return
of completion status itself does work fine.

== aa.py:
import sys
print "exiting with",sys.argv[1]
sys.exit(int(sys.argv[1]))

== a.bat:
@echo off
echo Start
python aa.py %1
if errorlevel 10 echo 10 or more
if errorlevel 20 echo 20 or more
if errorlevel 30 echo 30 or more
if errorlevel 40 echo 40 or more

D:\ian>a 12
Start
exiting with 12
10 or more

D:\ian>a 31
Start
exiting with 31
10 or more
20 or more
30 or more

D:\ian>


Alex






More information about the Python-list mailing list