0

I get the error

      print("blablablablabla ", str(mode), " am string ende in blablabla für das symbol ", str(sym)," existiert nicht.")                  
                                     ^

SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xfc in position 38: invalid start byte

But at nearly every string. Suddenly, out of nowhere. This code lines existed since days and didnt throw an error, till yesterday. What todo?

EDIT: (might be useful) I noticed that it also comes up when using strings like "ü ö ä".

  • Can you print your full error code? That ü looks like it might be causing some problems. – JimmyCarlos Jul 24 '20 at 23:41
  • 1
    What is `mode` and `sym`?? – Mark Jul 24 '20 at 23:47
  • @MarkMeyer strings which do not contain any äüö –  Iroquois_Pliskin Jul 24 '20 at 23:48
  • @MarkMeyer I see what you mean but yes it is. I commented that line out and it did the exact same error on the other 60 print() calls. At one of them i changed ü to u and suddenly it worked. but for the other ones i have no idea and i also need to use äöü again. :/ –  Iroquois_Pliskin Jul 24 '20 at 23:55
  • 2
    Is your python source file utf-8 encoded? – Mark Jul 24 '20 at 23:59
  • @MarkMeyer idk, How to check that? –  Iroquois_Pliskin Jul 24 '20 at 23:59
  • 1
    That will depend on the editor you are using. In VSCode there is a menu at the bottom of the window to see/change. You can [check in windows with notepad](https://stackoverflow.com/questions/3710374/get-encoding-of-a-file-in-windows). You can also set the encoding of a file by putting something like this at the top: `# -*- coding: latin-1 -*-` so python interprets it correctly. – Mark Jul 25 '20 at 00:01
  • Its Iso 8859-1. When I open a new file in UTF8 it gives different "errors" which look like prints (because of the white color). Btw I am using spyder EDIT: sys.getdefaultencoding() says, that its actually utf-8, sorry –  Iroquois_Pliskin Jul 25 '20 at 00:09
  • even after adding # -*- coding: latin-1 -*- –  Iroquois_Pliskin Jul 25 '20 at 00:15
  • 1
    There is a reason why everyone tries to use utf-8 for everything. Encodings are a pain. Adding `# -*- coding: iso-8859-1 -*-` at the top might help. Honestly, I would take the time to recreate the source file in UTF-8. – Mark Jul 25 '20 at 00:17
  • this makes up different errors: not being able to import specific modules. ImportError: cannot import name 'feature_extraction' from 'feature_extraction' (D:/Arc/Arc_Project\Architecture\_2_Feature_Extraction\feature_extraction.py) –  Iroquois_Pliskin Jul 25 '20 at 00:18
  • even when i add # -*- coding: iso-8859-1 -*- to the top of the module –  Iroquois_Pliskin Jul 25 '20 at 00:19
  • that error was related to something different. Looks like it works now. –  Iroquois_Pliskin Jul 25 '20 at 00:32

0 Answers0