Getting Python exit code when calling Python script from Java program

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Jun 18 18:09:14 EDT 2008


En Wed, 18 Jun 2008 08:09:58 -0300, A.T.Hofkamp <hat at se-162.se.wtb.tue.nl>  
escribió:
> On 2008-06-18, Quill_Patricia at emc.com <Quill_Patricia at emc.com> wrote:

>> picking up 0. On investigation it turned out that the exit value being
>> read is from python.exe process, not from the Python script. Is there
>> any way I can obtain the return value of a python script from a Java
>
> This is not what I see happening here:
>
> x.py:
> import sys
> sys.exit(138)
>
> %  python2.4 x.py
> %  echo $?
> 138
>
> as you can see, the mechanism works at my Linux system.

It works fine on Windows too, the OS she appears to be using:

C:\TEMP>python x.py

C:\TEMP>echo %ERRORLEVEL%
138

-- 
Gabriel Genellina




More information about the Python-list mailing list