Python scripts and return codes

Gunars Lucans gunars at spss.com
Fri Sep 8 16:45:40 EDT 2000


Steve Holden wrote:
> 
> Gunars Lucans wrote:
> >
> > Is it possible for a Python script to send a return code back to the shell
> > that's running it?  Yes, I know I should be doing it all in Python :-), but I'm
> > trying to add a Python-based util to an existing shell script (on a Win platform
> > with a MKS Korn shell).
> 
> Look up the exit() function in the sys module.  You can return integer
> values to the calling processor from your programs.

I had tried sys.exit(rc) a few days ago and I'd swear it didn't return anything
but zero back to the shell.  That was on a Win98 system with version 1.5.2 or
1.6b1.  Right now, with 2.0b1 on NT4, it works like a charm.  I'll try to pin
down where I went wrong before.  Thanks for your help!

Gunars



More information about the Python-list mailing list