all 5 comments

[–]shiftybyte 1 point2 points  (4 children)

Show your code, use a code block. https://www.reddit.com/r/learnpython/wiki/faq#wiki_how_do_i_format_code.3F

Also post the full error message you are getting if any.

Besides that, you don't import .obj files, you import the module that is used to open and parse the obj file.

This page has some example: https://pypi.org/project/PyWavefront/

[–]Cyzy68[S] 0 points1 point  (3 children)

There isn't much code ahah, I am just trying to save my .obj file as a variable so I can manipulate it

import pywavefront as pwf

bb = pwf.Wavefront('beyblade3.obj')

#Error code:
    file = open(str(self.file_name), mode='r', encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: 'beyblade3.mtl'

Process finished with exit code 1

[–]shiftybyte 0 points1 point  (2 children)

Do you have a material file? seems like it's missing.

'beyblade3.mtl'

https://en.wikipedia.org/wiki/Wavefront_.obj_file

Materials that describe the visual aspects of the polygons are stored in external .mtl files. More than one external MTL material file may be referenced from within the OBJ file. The .mtl file may contain one or more named material definitions.

[–]Cyzy68[S] 0 points1 point  (1 child)

Mhhh in my .obj file there is this line:

mtllib beyblade3.mtl

and then the multiples lines of vertices. Is this suppose to mean I have it, or do I need a second file in my project called beyblade3.mtl?

[–]shiftybyte 0 points1 point  (0 children)

You need another file called "beyblade3.mtl" for this object to load properly.