How to fix Pronterface/Printrun UnicodeDecodeError: 'utf-8' codec can't decode byte ... in position ...: invalid continuation byte
Problem:
When starting Pronterface / Printrun on Linux using pronterface
, printrun
, python3 pronterface.py
or similar, you see an error message like
Traceback (most recent call last):
File "pronterface.py", line 62, in <module>
app = PronterApp(False)
File "/home/uli/dev/tools/Printrun/printrun/pronterface.py", line 2464, in __init__
self.mainwindow = PronterWindow(self)
File "/home/uli/dev/tools/Printrun/printrun/pronterface.py", line 170, in __init__
self.parse_cmdline(sys.argv[1:])
File "/home/uli/dev/tools/Printrun/printrun/pronsole.py", line 786, in parse_cmdline
self.process_cmdline_arguments(args)
File "/home/uli/dev/tools/Printrun/printrun/pronterface.py", line 1031, in process_cmdline_arguments
pronsole.pronsole.process_cmdline_arguments(self, args)
File "/home/uli/dev/tools/Printrun/printrun/pronsole.py", line 769, in process_cmdline_arguments
self.load_default_rc()
File "/home/uli/dev/tools/Printrun/printrun/pronsole.py", line 664, in load_default_rc
self.load_rc(config)
File "/home/uli/dev/tools/Printrun/printrun/pronsole.py", line 632, in load_rc
for rc_cmd in rc:
File "/usr/lib/python3.8/codecs.py", line 714, in __next__
return next(self.reader)
File "/usr/lib/python3.8/codecs.py", line 645, in __next__
line = self.readline()
File "/usr/lib/python3.8/codecs.py", line 558, in readline
data = self.read(readsize, firstline=True)
File "/usr/lib/python3.8/codecs.py", line 504, in read
newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd3 in position 4: invalid continuation byte
Solution
When you see this error message, typically your pronsolerc
is corrupted. In order to remove it,
rm -rf ~/.config/Printrun