[GRASS-dev] Catching an issue from external binary using grass Python Script

Jenny Turner jennyturner1980 at gmail.com
Thu Jul 28 19:07:29 EDT 2011


You are absolutely right. I made a mistake. I meant
p=subprocess.call(<COMMAND>)

If you use subprocess.call(), the return value is the return code of
> the child process.
>
> But In this case I obtain this in Command Output window:

>* This application has requested the Runtime to terminate it*>* in an unusual way.*>* Please contact the application's support team for more*>* information.*

*and my p is 3 (don't know why because in no place of the binary there
is any return 3)*

*Is it possible to get above text ("This application ..." in a variable?*

*Thanks*

*Jenny*



> If you use subprocess.Popen(), the .wait() method returns the child
> process' return code, which can also be retrieved from the .returncode
> attribute of the Popen object.
>
> Typically, a return code of zero indicates success while a non-zero
> value indicates failure. On Unix, a negative value indicates that the
> process terminated due to a signal.
>
> Neither call() nor Popen() raise an exception if the spawned program
> "fails" in some sense, only if they are unable to execute the program,
> query its status, etc.
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20110729/c7515d86/attachment.html


More information about the grass-dev mailing list