0

I can't run code in vs2022, if any string has special characters, not even a single print (I work with python). And this is all it takes to causes error:

print("Všetko dobré ľščťž")

And this is a error:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy\__main__.py", line 45, in <module>
    cli.main()
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy/..\debugpy\server\cli.py", line 444, in main
    run()
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy/..\debugpy\server\cli.py", line 285, in run_file
    runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\runpy.py", line 267, in run_path
    code, fname = _get_code_from_file(run_name, path_name)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\runpy.py", line 242, in _get_code_from_file
    code = compile(f.read(), fname, 'exec')
  File "C:\Users\boris.ziegler\source\repos\TemplateFilling - word\TemplateFilling - word\TemplateFilling___word.py", line 2
    string = "V�etko dobr� +��蝞"
                                  ^
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0x9a in position 1: invalid start byte

Do you know, how to fix it?

Timothy G.
  • 6,335
  • 7
  • 30
  • 46
SomeGuy
  • 97
  • 10

1 Answers1

1

So problem wasn't in Visual Studio itself, but in python compiler. Turn out python 3.9 is not doing great with special characters.

So I installed python 3.7. and everything is going fine.

SomeGuy
  • 97
  • 10