problems with scene editpr

ive been trying to use the scene python file in my game,i have typed this code in like instructed by the scene editor

import direct.directbase.DirectStart

from dude_2 import *
theScene=SavedScene() #instantiate the class

run()

I keep getting this error “name ‘directobject’ is not defined”

You probably didn’t import DirectObject in your dude_2.py file.

i have imported directobject into python

from direct.showbase.DirectObject import DirectObject

and it still gives me the same message

have i missed something

hello evreyone
i have fixed the problem but now there is another problem
i had to import about 5 libaries and when i had done all that,i got the final error saying this

‘nonetype’ object has no attribute ‘setPosHprScale’

i dont know what this means and isnt the scene editor meant to import all the required libaries
how do i fix this so my game will work
thanks

Probably the problem is that it can’t find your models.
Check the .py file if the paths are correct.

This is a standard Python error message.

It’s meaning is rather explicit. It means

  • that the object that caused this error has type “NoneType”,
  • and that is has no attribute “setPosHprScale”.

Now let’s think a little bit:

What objects have type “NoneType”? The “None” object. “None” doesn’t have any attributes or methods (except from Python internals like init, del, repr and so on).

Why did you try to access “setPosHprScale” for an objects that is “None”? Probably because you have been assuming it is something else, most likely a NodePath. A NodePath would have an attribute “setPosHprScale”.

Why did you assume your object is a NodePath? Probably because it has been assigned from a Panda3D function that should return a NodePath, e.g. “loadModel” or “loadModelCopy”.

Why did “loadModel” return None and not a NodePath? Because if failed to load the model. Returning None is a common way to flag an error without raising an error. The user has the chance to check for None and handle errors himself, e.g. by popping up a message box or raising an error.

Why did “loadModel” fail? Now I have to guess. But the most common cause is a wrong path to the model file.

So what is to do: Check the model path. Probably it isn’t there, or somewhere else, or has been renamed.

enn0x