'taskMgr' is not defined

I’m trying to get a server repository to work, however I keep crashing because taskMgr isn’t defined. I looked in the source, and it is?

    self.serverRepository = ServerRepository(tcpPort=6667, udpPort=6667)
  File "C:\Panda3D-1.8.1\direct\distributed\ServerRepository.py", line 97, in __
init__
    taskMgr.setupTaskChain('flushTask')
NameError: global name 'taskMgr' is not defined

Hi Commander,

Sounds like taskMgr is not imported or you are calling taskMgr incorrectly, try the following list with suggested ideas to fix the problem.

1. You have imported “from direct.task import Task
2. You are using taskMgr in a DirectObject
3. Try using base.taskMgr

Hope this helps!

Regards,
DecodedLogic

There is no need to do either 1 or 2 above. They have nothing to do with it. There is no requirement for anything to import Task or inherit from DirectObject, especially not to use the task manager.

The error indicates that ShowBase has not been instantiated yet. Either import ShowBase and instantiate it, or import DirectStart, which does that for you.