obj2png icon indicating copy to clipboard operation
obj2png copied to clipboard

ValueError: invalid literal for int() with base 10: '1/'

Open simonbirkerhtwg opened this issue 3 years ago • 2 comments

Hello dear pclausen,

first things first: thank you so much for this script, it is exactly what I need!

But when running the script as you propose, I am facing the following issue:

Traceback (most recent call last):
  File "obj2png.py", line 121, in <module>
    ob = ObjFile.ObjFile(objfile)
  File "/Users/obj2png/src/ObjFile.py", line 59, in __init__
    self.ObjParse(obj_file)
  File "/Users/obj2png/src/ObjFile.py", line 97, in ObjParse
    faces.append(ObjFile.ToInts(f[1:]))
  File "/Users/obj2png/src/ObjFile.py", line 133, in ToInts
    v.append(int(nn))
ValueError: invalid literal for int() with base 10: '1/'

Apparently, I am not able to fix this issue. Can you help?

Cheers :)

simonbirkerhtwg avatar Apr 14 '21 10:04 simonbirkerhtwg

@simonbirkerhtwg sorry for taking so long to reply. I suspect your .obj file has some format my very simply parser does not recognize. If you could upload the file it would help a lot.

pclausen avatar Jul 04 '21 22:07 pclausen

@pclausen I have a similar error with .obj file attached.

test.zip

EmptyBox-Design avatar Aug 25 '21 15:08 EmptyBox-Design

Same error here :( Any solution? Thanks.

agGitHub avatar Sep 27 '22 09:09 agGitHub

Your .obj file is most likely formatted differently. Within ObjFile.py, try changing the following line

faces.append(ObjFile.ToInts(f[1:]))

to

faces.append(ObjFile.ToInts([s.split('/')[0] for s in f[1:]]))

PascalHbr avatar Sep 30 '22 20:09 PascalHbr

@PascalHbr Thanks for simple fix.

@simonbirkerhtwg @agGitHub Issue is now fixed

pclausen avatar Dec 30 '22 14:12 pclausen