In the Linux system interpreter, the display of Cyrillic characters for Python is correct, but through Sublime Text 3 I cannot achieve a normal display. What is the problem?

In the settings of SublimeREPL there is a line

`"default_extend_env": {"PYTHONPATH": "/usr/bin/python3"},` 

Tried and /usr/bin/python and played for a long time with other settings, the effect is zero. On Windows, everything worked fine, but on Linux problems.

If you run the following code in Sublime Text 3,

 print(1, "Привет", 2) 

That at performance the quite clear error will jump out:

 File "untitled.py", line 1 SyntaxError: Non-ASCII character '\xd0' in file untitled.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details 

If you execute such code,

 #!/usr/bin/python # -*- coding: utf-8 -*- print(1, "Привет", 2) 

That works out without errors, but the output is:

 (1, '\xd0\x9f\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82', 2) ***Repl Closed*** 

Replacing #!/usr/bin/python with #!/usr/bin/python3 didn’t change anything either

  • Let me try to guess: in the Python 3 system, and in the sublime Python 2? - andreymal
  • @andreymal, in the settings of sublimeREPL there is a line "default_extend_env": {"PYTHONPATH": "/ usr / bin / python3"}, it still does not help. everything worked fine on Windows and problems on Linux - MIKS
  • 3
    Start with a minimal code example that demonstrates a problem, for example: print("hello \U0001F602 мир!") (This is all code). minimal reproducible example Give the results in the terminal and from your editor. If possible, in the form of text, not pictures (if you don’t know how to copy the text in your environment, ask). By the way, PYTHONPATH is an environment variable used for sys.path it should be empty normally and there is nothing to do with the path to the python3 executable file, even if it is not empty. - jfs
  • @ Mikhail PYTHONPATH - the path to the directory with python modules, and not to the python itself, but the python may still be the second - andreymal
  • one
    Edited the question - MIKS

0