I started running into an issue after a recent system update on my Ubuntu machine. A lot of third-party python files suddenly are throwing UnicodeDecodeErrors like this:
ERROR : startup/gui/menus.py : Error loading Arnold module - "'utf-8' codec can't decode byte 0xa0 in position 0: invalid start byte".
Traceback (most recent call last):
File "/home/julius/bin/gaffer-1.3.2.0-linux/startup/gui/menus.py", line 123, in <module>
import GafferArnoldUI
File "/home/julius/bin/gaffer-1.3.2.0-linux/lib/python3.7/site-packages/shiboken2/files.dir/shibokensupport/feature.py", line 139, in _import
return original_import(name, *args, **kwargs)
File "/home/julius/bin/gaffer-1.3.2.0-linux/arnold/7.2/python/GafferArnoldUI/__init__.py", line 41, in <module>
from . import ArnoldShaderUI
File "/home/julius/bin/gaffer-1.3.2.0-linux/lib/python3.7/site-packages/shiboken2/files.dir/shibokensupport/feature.py", line 139, in _import
return original_import(name, *args, **kwargs)
File "/home/julius/bin/gaffer-1.3.2.0-linux/arnold/7.2/python/GafferArnoldUI/ArnoldShaderUI.py", line 400, in <module>
__translateNodeMetadata( arnold.AiNodeEntryIteratorGetNext( nodeIt ) )
File "/home/julius/bin/gaffer-1.3.2.0-linux/arnold/7.2/python/GafferArnoldUI/ArnoldShaderUI.py", line 255, in __translateNodeMetadata
presetValues = __enumPresetValues( param )
File "/home/julius/bin/gaffer-1.3.2.0-linux/arnold/7.2/python/GafferArnoldUI/ArnoldShaderUI.py", line 132, in __enumPresetValues
preset = arnold.AiEnumGetString( enum, len( presets ) )
File "/opt/Autodesk/arnold/7.2.3.2/python/arnold/ai_enum.py", line 22, in AiEnumGetString
return AtPythonStringToStr(_AiEnumGetString(enum_type, index))
File "/opt/Autodesk/arnold/7.2.3.2/python/arnold/ai_types.py", line 36, in AtPythonStringToStr
return str(astring)
File "/opt/Autodesk/arnold/7.2.3.2/python/arnold/ai_types.py", line 28, in __str__
return self.decode()
File "/opt/Autodesk/arnold/7.2.3.2/python/arnold/ai_types.py", line 33, in decode
return self.value.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 0: invalid start byte
Here's an example of the third-party apps that stopped working: https://github.com/gafferHQ/gaffer https://arnoldrenderer.com/ These apps contain many python files and consequently editing the source files is not really an option for me, especially since they used to work just fine before the system update.
My initial feeling was that the locales on my system were messed up. I tried resetting them to factory defaults and rebooted to no avail:
> locale
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
My python version points to this:
> ll $(which python)
lrwxrwxrwx 1 root root 24 Sep 9 15:23 /usr/bin/python -> /etc/alternatives/python
> ll /etc/alternatives/python
lrwxrwxrwx 1 root root 19 Sep 9 15:23 /etc/alternatives/python -> /usr/bin/python3.10
I'm unfortunately a bit stuck here as I am not sure what to look out for. Any pointers would be greatly appreciated.