[Python] Error using python on z/OS - no encoding declared [duplicate]

Discussão em 'Python' iniciado por Stack, Junho 19, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to write a python script under z/OS, using IBM Open Enterprise SDK for Python 3.13.

    I wrote the code under TSO OMVS and I got the following error trying to execute the code:

    SyntaxError: Non-UTF-8 code starting with 'çx97' in file /u/u0n6758/prova5.py on line 1, but no encoding declared; see peps.python.org/pep-0263/ for details

    In the text there some # and {}.

    If I change the # in £ and delete the {} the code is working. The problem is that I need the {} (I have to deal with json).

    I would not like to change all the special character on my script (the script was written on a Linux machine and there is working properly - I need to have it on USS now).

    I've tried to put in the second line the enconding statement, using both IBM1047 than UTF-8 ma it didn't work. I'm not sure about the encoding statement syntax on z/OS. I've used £-- coding: IBM1047 --

    Can anybody help me please? thanks Fabiana Can anyone please me help me? where can I find documentation about syntax python under z/OS?

    Thanks everybody, have a nice day, Fabiana

    Continue reading...

Compartilhe esta Página