OSError: Could not load Actor model

I’m encountering this problem “OSError: Could not load Actor model Character/daz.gltf” when I run my model in pycharm IDE. The used character is exported from blender as .gltf and located in a folder inside the pycharm project folder.

I don’t know the reason behind this error. I tried to use the complete path to the character, but unfortunately this doesn’t work, also I tried to put the character in the pandas3d’s models folder but this doesn’t work also.

could you please help me?!

(this the code I used):

from direct.actor.Actor import Actor
from direct.showbase.ShowBase import ShowBase

class MyGame(ShowBase):
def init(self, character, dict_of_motion):
self.model = Actor(character,
# dict_of_motion
self.cam.setPos(2, -20, 0)

game = MyGame(‘Character/daz.gltf’,
{’’: ‘’})

Hi Sara, welcome to the community!

In order to load .gltf files in Panda3D, one must currently use panda3d-gltf which can be installed via pip.

Could you try the following program and let us know if it works?

from direct.showbase.ShowBase import ShowBase
from direct.actor.Actor import Actor
from panda3d.core import AmbientLight
import gltf

class main(ShowBase):
     def __init__(self):
         self.model = Actor(loader.load_model('daz.gltf'))
         self.cam.set_pos(0, -10, 1)
         amb_light = AmbientLight('amblight')
         amb_light.set_color((2, 2, 2, 1))
         amb_light_node = self.render.attach_new_node(amb_light)
app = main()

This code assumes that daz.gltf is located in the top of your program directory.

Hi Simulan, thanks for your time and support.
I run your code and I put the daz.gltf file in the project directory, but it gives me this error:
OSError: Could not load model file(s): [‘daz.gltf’]

is that error related to a file damage during the conversion in blender? or something else?

It does seem like a path issue. You should ensure that your PyCharm environment is properly set up, or better yet run your program from the terminal/CLI at your program directory.

Perhaps somebody else here has an idea what may be the problem.

I already run a different model and it works. The problem arises when I use the daz.gltf model and I don’t know why!

Well, that is good news, and would seem to imply that your environment is set up properly.

Unfortunately, I’m not sure why a model exported in the same way, in the same directory, would throw such an OSError either.

Thanks a lot Simulan for your time.

1 Like

That error could indeed indicate that there is a problem with the model file itself.
But to know for certain, it would be helpful if you could show us the complete traceback related to the error.
If it contains the following:

RuntimeError: Failed to convert glTF file
:loader(error): Loading daz.gltf failed with RuntimeError exception.

then there could effectively have been a problem when exporting from Blender, as you suggested.
As to what could have gone wrong exactly, I cannot say, however.

Please include the full error message. I have the feeling we are missing a critical part of the error output.