[Newbie] Problem modifying a sample

Hi,
I am quite the Python newbie :blush:

I started from the roaming Ralph sample. Now, after these lines…

        self.environ = loader.loadModel(MYDIR+"/models/world")      
        self.environ.reparentTo(render)
        self.environ.setPos(0,0,0)

I added this…

        self.axis = loader.loadModel(MYDIR+"/Models/3Axis") 
        self.axis.reparentTo(render)

I placed the 3Axis.egg into the models directory (I had another file that could load it, so, I know the model file is not corrupt).

I get this error…

Traceback (most recent call last):
  File "Tut-Roaming-Ralph.py", line 261, in ?
    w = World()
  File "Tut-Roaming-Ralph.py", line 74, in __init__
    self.axis.reparentTo(render)
AttributeError: 'NoneType' object has no attribute 'reparentTo'

Any help would be greatly appreciated. I don’t really understand what this error means to begin with.

Thanks in advance

Hi, welcome to the panda forums :slight_smile:

I’m not so experienced (yet ^^) myself, but your problem seems pretty straightforward:

AttributeError: 'NoneType' object has no attribute 'reparentTo' 

NoneType can be seen as a ‘Null object’, which means that

loader.loadModel(MYDIR+"/Models/3Axis")

did not come back with your model, which is most likely caused by the capital M in your /Models/ directory.

Good luck!
Roel

Usually when a model fails to load, the notifier gives you more information above the final error line. Be sure to check above the error traceback in your console for more information on where your model is (or isn’t :wink:)

Welcome to the forums!

Take care,
Mark