× 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 believe PYRUN only picks up STDOUT currently.

It will also get an error exit code if you set one or one gets surfaced from your Python code.

I always have my Python exit with an error code of 99 for an unhandled condition.

Then PYRUN picks up the error and sends a CPF error.

I believe STDERR could also be hooked up to get captured as well. I just tend to pipe everything to STDOUT instead.

Regards,
Richard Schoen
Web: http://www.richardschoen.net
Email: richard@xxxxxxxxxxxxxxxxx
Phn: (612) 315-1745

----------------------------------------------------------------------

message: 1
date: Fri, 2 Aug 2019 14:49:36 -0400
from: John Yeung <gallium.arsenide@xxxxxxxxx>
subject: [IBMiOSS] How to get Python errors to cause MSGW job status?

Though IBM's Python 3.6 for PASE is a significantly better language overall than iSeriesPython 2.7, there are still some aspects of iSeriesPython that I like better.

One of them is that when an exception occurs in an iSeriesPython program, it registers as a WRKACTJOB-visible error. The error itself isn't particularly informative; it's just "application error" and then you have to dig further. Or maybe the job ends automatically but abnormally. In any event, you get *some* kind of system-level indication that something went wrong.

I've been using Python 3.6 for PASE, and all the jobs end "normally", no matter what. It's been difficult for me to get into the habit of always verifying every single job by looking at the spooled output.
Even if I do eventually get to the point that it's a habit, it's still pretty damn annoying and productivity-sapping.

So, one brainstorming challenge for myself and anyone else who is inclined to think about this is: Can we build a Python calling system that detects Python exceptions and causes MSGW?

I would be remiss if I didn't point out that Richard Schoen's "Python on i" library does at least make it easy for Python output to go to the job log. He deserves credit for what is the current "Cadillac of Python wrappers". But if the job ends normally, how do I know to check the job log? It's essentially the same issue I have now, just that my output goes to spooled files named QPRINT instead of to the job log.

Now, I haven't really dissected Richard's library. Perhaps it could be adapted so that output to stderr triggers an error message or abnormal end.

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.