class DirectObject has no attribute 'DirectObject'

from direct.showbase.DirectObject import DirectObject

class ReadKeys(DirectObject.DirectObject):
  def __init__(self):
	self.accept("w",walk)
	self.accept("a",rotate,[-1])
	self.accept("d",rotate,[1])

It run then closes down, this is what the command says.

C:\>python test.py
DirectStart: Starting the game.
Known pipe types:
  wglGraphicsPipe
(all display modules loaded.)
Traceback (most recent call last):
  File "test.py", line 53, in <module>
    class ReadKeys(DirectObject.DirectObject):
AttributeError: class DirectObject has no attribute 'DirectObject'

Tubutas, the reason this is happening is the way you imported DirectObject. Try using just DirectObject instead of DirectObject.DirectObject, like this:

from direct.showbase.DirectObject import DirectObject 

class ReadKeys(DirectObject): 
  def __init__(self): 
   self.accept("w",walk) 
   self.accept("a",rotate,[-1]) 
   self.accept("d",rotate,[1])

Worked Thanks