× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I think the return code API is a great approach. Different conditions set different values. Just like ERRNO in C.

I don't know if/how it would work with a syntax error like the indent, but that should get weeded out in testing.

Thank you Kevin!


-----Original Message-----
From: OpenSource [mailto:opensource-bounces@xxxxxxxxxxxx] On Behalf Of John Yeung
Sent: Thursday, September 29, 2016 2:56 PM
To: IBMi Open Source Roundtable
Subject: Re: [IBMiOSS] Checking return status of Pyhon program

On Thu, Sep 29, 2016 at 11:47 AM, Roger Harman <roger.harman@xxxxxxxxxxx> wrote:
For example, I made a slight change and had an indentation error. Obvious Python failure but how can I inform the CL?

You seem to be interested in a broad range of error conditions. If you
are talking about getting the "full-blown" feedback for ANY kind of
Python error (in other words, the Python traceback), then I believe
you have no recourse but to do some kind of logging to some kind of
file. This could take the form of just redirecting stdout and/or
stderr, or using Python's logging module (as Jim mentioned), or
something custom. It wouldn't have to be a stream file; Python can
write to database tables, if that makes it easier on the CLP.

If you are just interested in a simple program status (like "success"
or "failure", or perhaps up to a handful of different predetermined
status codes), then the API Kevin mentioned is pretty much tailor-made
for that. (You would have to make sure the Python application is
properly setting the exit code. This isn't a universal or automatic
thing.)

John Y.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.