Page MenuHome

python crashes with path containing utf8 characters
Closed, ResolvedPublic

Description

System Information
Windows 7 x64

Blender Version
Broken: latest master

Short description of error
If a non-Ascii character is present in path of a preset, it crashes.

Exact steps for others to reproduce the error
add this preset to your collada preset folder:

and try to load it when calling the collada importer.

Event Timeline

I could reproduce the very same issue with the FBX Exporter. So this is related to how the preset system figures out which values need to be stored.

  • Add a filename with a special character into the filepath field
  • store a new preset
  • select the new preset
Traceback (most recent call last):

  File "...\2.78\scripts\startup\bl_operators\presets.py", 
       line 229, in execute
       bpy.ops.script.python_file_run(filepath=filepath)

  File "...\2.78\scripts\modules\bpy\ops.py", 
       line 189, in __call__
       ret = op_call(self.idname_py(), None, kw)

RuntimeError: Error: Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "...\2.78\scripts\presets\operator\export_scene.fbx\mypreset.py", line 4

SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xf6 in position 0:
invalid start byte
Bastien Montagne (mont29) changed the task status from Unknown Status to Archived.Mar 14 2017, 3:22 PM
Bastien Montagne (mont29) claimed this task.

There’s no bug here, Blender expects its files to be encoded in Unicode UTF8, while yours is in ISO 8859-1… Just be careful with the text editor you use when editing a py script.

Bastien Montagne (mont29) changed the task status from Archived to Unknown Status.Mar 14 2017, 4:02 PM
Bastien Montagne (mont29) lowered the priority of this task from 90 to 50.

So, issue is actually with windows, where default encoding is usually not utf-8 one... Fix incoming.