The simplest python program print(‘hello’) fails with 9.
//BPX EXEC PGM=BPXBATSL,
// PARM=‘PGM /C/Rocket/python36/bin/python /a/private_folder/test.py’
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDENV DD *
STDERR contains some garbage:
If I change BPXBATSL to BPXBATCH with sh instead of pgm in PARM, then job is successful, but I’m going to use DDNs in the future scripts. Is there any idea why the code fails and how to see normal letters?
I am facing exactly the same issue. Any solutions you have found so far?
I saw that only with Python 3.6. With Python 2.7 I see normal error message. Since version 3.6 can’t work with opening data sets using DD cards i.e. f = open(’//DD:INDD’, ‘r’) doesn’t work, I use only Python 2.7 where there is no garbage.
******************************** Bottom of Data *******************
If all 1 and 2 ways work fine and 3 fails, then obviously problem in your env. Something might be missing. You need to put everything from your .profile to be sure that you’ve got all the needed. Keep in mind that in .profile you can have symbolic variables like $PATH. In EVN data set you need to provide paths as they are.
Thank you very much for your quick response again. The problem was that I was browsing the STDERR file, instead when I viewed/edited it using ISPF 3.17 (Z/OS UNIX Directory List) option, what was being shown as garbage started showing up as readable text.
The problem in my program was that I did not create the file with appropriate encoding. I followed the below advice given in this forum, but as a response to a different question, after which it all worked:
<<Advice I followed - begin>>
I would recommend you to delete existing file, create the file again (touch test1.py), tag it (chtag -tc ISO8859-1 test1.py). After that add a content into the file and run it.
<<Advice I followed -end >>