Skip to main content

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

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

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?

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?
  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


  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

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


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

Tatyana,

That worked !!!

Thanks,

Kent