Python scripts and return codes

jurgen.defurne at philips.com jurgen.defurne at philips.com
Mon Sep 11 09:47:30 EDT 2000


gunars at spss.com@SMTP at python.org on 08/09/2000 23:24:19
Sent by:	python-list-admin at python.org
To:	python-list at python.org@SMTP
cc:	sholden at holdenweb.com@SMTP 
Subject:	Re: Python scripts and return codes
Classification:	

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
--
http://www.python.org/mailman/listinfo/python-list


Somewhere in the documentation I have seen that under Win95/Win98 the return value from a process (system) is always
0 !

Jurgen



More information about the Python-list mailing list