Open-source Languages & Tools for z/OS

 View Only
  • 1.  Python's print() produces ASCII ouutput

    Posted 04-16-2019 12:50

    We are successfully using standalone Python and Python API in z/OS 2.2 except one thing. In standalone Python print() statements produce output that is correctly displayed on a screen (thanks to _BPXK_AUTOCVT=ON). However when we use API (with the same environment variables exported) the output from print() statements appears to be in ASCII.
    When this happens the stderr contains a line

    tput: unknown terminal “/pgm/u/myHomeDir”

    Our application is compiled as EBCDIC and switches environment to ASCII before using any API calls.
    Any idea what can be done to make print statements work?

    Thank you
    Best regards
    Jacob



  • 2.  RE: Python's print() produces ASCII ouutput

    ROCKETEER
    Posted 04-23-2019 04:24

    Hi Jacob,
    Can you please provide us some more details: which application do you use to call API, how do call it, etc
    Thanks,
    Alex



  • 3.  RE: Python's print() produces ASCII ouutput

    Posted 04-23-2019 09:25

    Hi Alex,
    this is a main() that was compiled as EBCDIC, we call Python API to initialize Python environment and execute py scripts.
    Everything seems to work fine except print() statements in Python - they appear on a screen as ASCII strings.
    I have already contacted IBM and they say that LE environment was initialized as EBCDIC and thus no conversion occures even when string is coming from ASCII dll.
    So I think nothing can be done now, unless Python itself takes care of this situation. For example if it knows that it is being used from EBCDIC main() it can convert all print’s to EBCDIC.

    Thanks,
    Jacob