Looking into this a little deeper, I found a bug in the proc where these early failures are exiting the proc without a failure rc. I've fixed those cases and now &SYSERR is correctly being set when there is a failure. So, once this propagates into whatever release it gets in, you will be able to check &SYSERR to see if the proc failed or not. SYSERR gets set (reset) after each step, while SYSERRTEXT doesn't get reset. That's not the proc behavior, but rather SAS's way it sets, or doesn't, these various macro variables.
But, that should be a much cleaner way to programmatically check.
Tom
1?
2? proc python;quit;
%put &syserr &syserrortext &sysrc &syscc &syswarningtext;
options set=PROC_PYPATH='/bad/path'; /* make it fail */
proc python restart;quit;
%put &syserr &syserrortext &sysrc &syscc &syswarningtext;
options set=PROC_PYPATH='/usr/bin/python3.5'; /* make it work again */
proc python restart;quit;
%put &syserr &syserrortext &sysrc &syscc &syswarningtext;
NOTE: Python initialized.
Python 3.5.6 (default, Nov 16 2018, 15:50:39)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
NOTE: PROCEDURE PYTHON used (Total process time):
real time 1.97 seconds
cpu time 0.07 seconds
4?
0 0 0
8?
NOTE: Python terminated.
NOTE: Previous Python state destroyed.
ERROR: Failed to create Python subprocess.
NOTE: Python terminated.
ERROR: Launch Failed. Cannot execute program "/bad/path", error = 2 (No such
file or directory).
ERROR: The specified executable module either cannot be located or it is not
a valid executable.
ERROR: Failed to launch Python sub-process in tkpy extension.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PYTHON used (Total process time):
real time 0.07 seconds
cpu time 0.01 seconds
9?
1012 Failed to launch Python sub-process in tkpy extension. 0 1012
13?
NOTE: Python initialized.
Python 3.5.6 (default, Nov 16 2018, 15:50:39)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
NOTE: PROCEDURE PYTHON used (Total process time):
real time 1.10 seconds
cpu time 0.01 seconds
15?
0 Failed to launch Python sub-process in tkpy extension. 0 1012
17?
... View more