Open-source Languages & Tools for z/OS

 View Only
  • 1.  Non-UTF-8 code starting with '\x89'

    Posted 06-08-2018 12:17

    Hello All,
    I have read the page listed below and tried a few things.
    Any ideas?

    SyntaxError: Non-UTF-8 code starting with ‘\x89’ in file test1.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details



  • 2.  RE: Non-UTF-8 code starting with '\x89'

    Posted 06-12-2018 05:17

    Hi Kent,
    can you provide some more information.

    1. which Python version do you use?
    2. in what encoding is the contents of the file?
    3. does the file have some encoding defined?
      > ls -T test1.py
    4. you can define the encoding of a file with
      chtag -tvc UTF-8 test1.py
    5. do you have environment variable _BPXK_AUTOCVT set to ON?


  • 3.  RE: Non-UTF-8 code starting with '\x89'

    Posted 06-13-2018 13:19
    1. Python version 3.6.1

    2. Not what the encoding of the file is. It is just a two line file I created with vi.
      cat test1.py produces the following:
      import os, sys
      print (‘HELLO’)
      3/4. I tried the chtag command to set the tag.

    3. Yes. _BPXK_AUTOCVT=ON



  • 4.  RE: Non-UTF-8 code starting with '\x89'

    Posted 06-19-2018 09:01

    Hi Kent,

    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.

    Thanks,
    Tatyana



  • 5.  RE: Non-UTF-8 code starting with '\x89'

    Posted 06-19-2018 14:37

    Tatyana,

    That worked !!!

    Thanks,

    Kent