IndexError when importing malformatted obj file #83671

Closed
opened 2020-12-11 16:12:51 +01:00 by Jens · 7 comments

System Information
Operating system: Linux-5.4.0-56-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: GeForce RTX 2070 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 455.45.01

Blender Version
Broken: version: 2.92.0 Alpha, branch: master, commit date: 2020-12-10 21:48, hash: blender/blender@caed4849d0
Worked: none

Addon Information
Name: Wavefront OBJ format (3, 8, 0)
Author: Campbell Barton, Bastien Montagne

Short description of error
I have a software that unfortunately exports obj files with some missing face information.
(A line that should describe a face only starts with 'f' and nothing afterwards)
Importing those obj files into blender results in an IndexError:

Python: Traceback (most recent call last):
  File "/home/jens/blender/blender-2.92/2.92/scripts/addons/io_scene_obj/__init__.py", line 146, in execute
    return import_obj.load(context, **keywords)
  File "/home/jens/blender/blender-2.92/2.92/scripts/addons/io_scene_obj/import_obj.py", line 1079, in load
    context_multi_line = b'f' if strip_slash(line_split) else b''
  File "/home/jens/blender/blender-2.92/2.92/scripts/addons/io_scene_obj/import_obj.py", line 869, in strip_slash
    if line_split[-1][-1] == 92:  # '\' char
IndexError: list index out of range

location: <unknown location>:-1```

The cause of this problem of course is that other software but it is preferable to just skip such erroneous lines and still import the rest of the file.


**Exact steps for others to reproduce the error**
Import the the following example file:
{F9502833}

**System Information** Operating system: Linux-5.4.0-56-generic-x86_64-with-debian-buster-sid 64 Bits Graphics card: GeForce RTX 2070 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 455.45.01 **Blender Version** Broken: version: 2.92.0 Alpha, branch: master, commit date: 2020-12-10 21:48, hash: `blender/blender@caed4849d0` Worked: none **Addon Information** Name: Wavefront OBJ format (3, 8, 0) Author: Campbell Barton, Bastien Montagne **Short description of error** I have a software that unfortunately exports obj files with some missing face information. (A line that should describe a face only starts with 'f' and nothing afterwards) Importing those obj files into blender results in an IndexError: ``` Python: Traceback (most recent call last): File "/home/jens/blender/blender-2.92/2.92/scripts/addons/io_scene_obj/__init__.py", line 146, in execute return import_obj.load(context, **keywords) File "/home/jens/blender/blender-2.92/2.92/scripts/addons/io_scene_obj/import_obj.py", line 1079, in load context_multi_line = b'f' if strip_slash(line_split) else b'' File "/home/jens/blender/blender-2.92/2.92/scripts/addons/io_scene_obj/import_obj.py", line 869, in strip_slash if line_split[-1][-1] == 92: # '\' char IndexError: list index out of range location: <unknown location>:-1``` The cause of this problem of course is that other software but it is preferable to just skip such erroneous lines and still import the rest of the file. **Exact steps for others to reproduce the error** Import the the following example file: {F9502833}
Author

Added subscriber: @Jens.Ne

Added subscriber: @Jens.Ne
Author

I will attempt to submit a fix for this myself :)

I will attempt to submit a fix for this myself :)
Author

I created the following Differential Revision: [D9828 ](https://developer.blender.org/D9828)

I created the following Differential Revision: [[D9828](https://archive.blender.org/developer/D9828) ](https://developer.blender.org/D9828)
Member

Added subscriber: @ankitm

Added subscriber: @ankitm
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

This issue was referenced by f8a16827a2

This issue was referenced by f8a16827a2568088e5206e9d4432c5b57aae3eb5

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Bastien Montagne self-assigned this 2020-12-15 12:17:14 +01:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#83671
No description provided.