pywavefront / PyWavefront

Python library for importing Wavefront .obj files
BSD 3-Clause "New" or "Revised" License
312 stars 80 forks source link

parse failure for alias wavefront obj created in ANALYZE (invalid continuation byte) #150

Closed nimzodisaster closed 1 year ago

nimzodisaster commented 1 year ago

Hello, I am trying to parse an .obj Alias Analyze file (attached, renamed to .txt to upload) However, I get an error on parse:

>>> scene.parse()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jlee38/.local/lib/python3.10/site-packages/pywavefront/wavefront.py", line 84, in parse
    self.parser.parse()
  File "/home/jlee38/.local/lib/python3.10/site-packages/pywavefront/obj.py", line 90, in parse
    super(ObjParser, self).parse()
  File "/home/jlee38/.local/lib/python3.10/site-packages/pywavefront/parser.py", line 123, in parse
    self.next_line()
  File "/home/jlee38/.local/lib/python3.10/site-packages/pywavefront/parser.py", line 99, in next_line
    self.line = next(self.lines)  # Will raise StopIteration when there are no more lines
  File "/home/jlee38/.local/lib/python3.10/site-packages/pywavefront/parser.py", line 92, in create_line_generator
    for line in file:
  File "/usr/lib/python3.10/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 2-3: invalid continuation byte

test.obj.txt

nimzodisaster commented 1 year ago

and using encoding="iso-8859-1" avoids the error but parses junk

Unimplemented OBJ format statement '' on line '

                                                    '

Unimplemented OBJ format statement '' on line ' �«ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿAÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ¬' on line '¤�«ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿAÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ¬ ¤y' Unimplemented OBJ format statement '' on line 'xt' Unimplemented OBJ format statement '�n' on line '�n 'm%'j&h'+g(,f-e+.c[a Na' Unimplemented OBJ format statement 'N' on line 'N Q]S[dYSXSV17ViTiSkRmQRPQN�RNqLrLrLrKYJ58I48I58H8:HvGvFvFvFvEvErCsCxCyCyCzCzCzCyCH)CG)CoD;D:;D<D <D!;E" E# E9!E8!G' Unimplemented OBJ format statement 'G7H89I8:I79J69K57L66N66O66O56P36P26Q16Q16R25SiT' on line 'G7H89I8:I79J69K57L66N66O66O56P36P26Q16Q16R25SiT ^UU*V0/V10V21V1' Unimplemented OBJ format statement '' on line '2W 2X#1Z&.Z-,[

greenmoss commented 1 year ago

That file looks like some kind of binary format. For reference, an example of a supported object file would look like https://github.com/pywavefront/PyWavefront/blob/master/tests/fixtures/simple.obj

I'm not sure what to do with the object above, so I'll close this for now as "unsupported".