All good. I transfer the script that I wrote on the beautiful beloved debian, to the hated Windows 7. I understand the problems of the paths as a double slash, that is, it was /, it became so for Windows \\ . It is fine, now already 2 hours I fight with an error

  File "C:\Python3.5\lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 4484: character maps to <undefined> 

I can not win, I have already rechecked everything everywhere UTF-8. But the error annoyingly eats the brain. Help pliz, thank you! Ps error when installing addons via selenium in firefox. Path to addons

 C:\no_restart 

in the script

 directory = 'C:\\no_restart\\' files = os.listdir(directory) addon = directory + str(random.choice(files)) 

All file names are in English.

Full error log

 Connected to pydev debugger (build 162.1967.10) Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2016.2.3\helpers\pydev\pydevd.py", line 1580, in <module> globals = debugger.run(setup['file'], None, None, is_module) File "C:\Program Files\JetBrains\PyCharm 2016.2.3\helpers\pydev\pydevd.py", line 964, in run pydev_imports.execfile(file, globals, locals) # execute the script File "C:\Program Files\JetBrains\PyCharm 2016.2.3\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "C:/Users/root/PycharmProjects/untitled/script.py", line 161, in <module> regger() File "C:/Users/root/PycharmProjects/untitled/script.py", line 56, in regger fp.add_extension(addon) File "C:\Python3.5\lib\site-packages\selenium\webdriver\firefox\firefox_profile.py", line 92, in add_extension self._install_extension(extension) File "C:\Python3.5\lib\site-packages\selenium\webdriver\firefox\firefox_profile.py", line 271, in _install_extension addon_details = self._addon_details(addon) File "C:\Python3.5\lib\site-packages\selenium\webdriver\firefox\firefox_profile.py", line 344, in _addon_details manifest = f.read() File "C:\Python3.5\lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 4484: character maps to <undefined> 
  • * that is, it was /, it became so for Windows \ * - but doesn’t Windows understand direct slashes? - PinkTux
  • No, swore at them - WattsCorey
  • The sample code in the question does not match the given traceback. It is more informative to give the text of the error and what action led to it in the title. Try to create a minimal example from scratch that leads to the same error. Describe what you expect the code to do and what happens step by step instead (if you run it in PyCharm you should mention it and check what happens if you run it in the Windows console). The error seems to be due to an incorrect encoding when reading a file, pass the explicitly correct encoding instead of the default encoding from the locale (on Windows, this is cp1251, Debian — utf-8) - jfs

0