Maniphest T68659

Error when Importing OBJ | UnicodeDecodeError
Closed, Archived

Assigned To
Robert Guetzkow (rjg)
Authored By
Ali Jafargholi (alijafargholi)
Aug 14 2019, 8:16 PM
Tags
  • BF Blender
Subscribers
Ali Jafargholi (alijafargholi)
Robert Guetzkow (rjg)

Description

System Information
Operating system: Microsoft Windows 10 Pro

Blender Version
Broken: (example: 2.80, edbf15d3c044, master, 2018-11-28, as found on the splash screen)
Worked: (optional)

We're getting an error when importing an OBJ. I think it's be cause some chines character in the model, but I'm sure you can shine some light on it.

python
Traceback (most recent call last):
  File "C:\Program Files (x86)\blender\2.80\scripts\addons\io_scene_obj\__init__.py", line 145, in execute
    return import_obj.load(context, **keywords)
  File "C:\Program Files (x86)\blender\2.80\scripts\addons\io_scene_obj\import_obj.py", line 1215, in load
    use_image_search, float_func)
  File "C:\Program Files (x86)\blender\2.80\scripts\addons\io_scene_obj\import_obj.py", line 407, in create_materials
    context_material_name, img_data, line, 'Ka')
  File "C:\Program Files (x86)\blender\2.80\scripts\addons\io_scene_obj\import_obj.py", line 139, in load_material_image
    image = obj_image_load(context_imagepath_map, line, DIR, use_image_search, relpath)
  File "C:\Program Files (x86)\blender\2.80\scripts\addons\io_scene_obj\import_obj.py", line 86, in obj_image_load
    imagepath = os.fsdecode(b" ".join(filepath_parts[i:]))
  File "C:\Program Files (x86)\blender\2.80\python\lib\os.py", line 823, in fsdecode
    return filename.decode(encoding, errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb1 in position 22: invalid start byte

location: <unknown location>:-1

I've attached the geometry that raises this issue.

If in fact the issue is caused with the characters in the path or something, do you have suggestion on how to fix it?

Appreciate your help in advance.
-Ali

Event Timeline

Ali Jafargholi (alijafargholi) created this task.Aug 14 2019, 8:16 PM
Robert Guetzkow (rjg) added a subscriber: Robert Guetzkow (rjg).EditedAug 14 2019, 9:18 PM

The issue is not in the .obj, but the accompaning .mtl which is not UTF-8 encoded. Re-Encode the .mtl to UTF-8 an it will open properly. Since .mtl is specified as ASCII format, this is not a bug in Blender. The .mtl simply doesn't follow the specification.

Robert Guetzkow (rjg) changed the task status from Unknown Status to Unknown Status.Aug 14 2019, 9:22 PM
Robert Guetzkow (rjg) claimed this task.

I'm closing this ticket since this is not a bug in Blender.

Robert Guetzkow (rjg) added a comment.Aug 14 2019, 9:44 PM

Also a duplicated of T67987. If you need further assistance to convert the file to the proper encoding or fix the map_* attributes in the file, please post a question on Blender's StackExchange.

Ali Jafargholi (alijafargholi) added a comment.Aug 16 2019, 10:36 AM

Hello Robert,

Thanks for looking into it.

Since this ticket is public, would you mind removing the OBJ attachment from the ticket please?

Thanks

Robert Guetzkow (rjg) updated the task description.Aug 16 2019, 10:47 AM
Robert Guetzkow (rjg) added a comment.Aug 16 2019, 12:14 PM

I don't have the required permission to delete the file and the edit history is public as well.