AssertionError: !is_empty()

I don’t know how to avoid this error “AssertionError: !is_empty() at line 315 of panda/src/pgraph/nodePath.cxx”

The code is

from direct.showbase.ShowBase import ShowBase
from direct.actor.Actor import Actor
from panda3d.core import Vec3
from panda3d.core import loadPrcFileData

loadPrcFileData("", "want-directtools #t")
loadPrcFileData("", "want-tk #t")

class Application(ShowBase):
   def __init__(self):
        ShowBase.__init__(self)
        self.teapot = loader.loadModel("teapot")
        self.teapot.reparentTo(render)
        self.teapot.setPos(-5, 0, 0)
        self.pandaActor = Actor("panda", {"walk": "panda-walk"})
        self.pandaActor.reparentTo(render)
        self.pandaActor.setPos(Vec3(5, 0, 0))
        self.pandaActor.loop("walk")
        self.cam.setPos(0, -30, 6)

I tried replace “from panda3d.core import loadPrcFileData” to “from pandac.PandaModules import loadPrcFileData” and got the same error, when I remove line “loadPrcFileData(”", “want-directtools #t”)" the code runs, and 2 windows show up, one with the scene working well, and another with a “tk” title but its empty window, so I think this line “loadPrcFileData(”", “want-directtools #t”)" calls something passing a empty “pointer” but how to avoid this?

If I edit config.prc and set “want-directtools #t” and “want-tk #t” I got the same error, so it’s not about my code, it’s something that I didn’t installed or something like that, anyone know how to fix it?

Obs: I don’t know how to fix indentation here either, its has spaces in function and in block inside functions, but for some reason when I click save it don’t shows indentation as expected.

Please share the full error message, including the traceback.

To show indentation, surround your code with ``` marks, one before the code block and one after it.

D:\pythonProject\venv\Scripts\python.exe D:/pythonProject/main.py
Known pipe types:
  wglGraphicsPipe
(all display modules loaded.)
Assertion failed: !is_empty() at line 315 of panda/src/pgraph/nodePath.cxx
Traceback (most recent call last):
  File "D:\pythonProject\main.py", line 4, in <module>
    gameApp = Application()
  File "D:\pythonProject\ApplicationQuickPanel.py", line 11, in __init__
    ShowBase.__init__(self)
  File "D:\pythonProject\venv\lib\site-packages\direct\showbase\ShowBase.py", line 521, in __init__
    self.__doStartDirect()
  File "D:\pythonProject\venv\lib\site-packages\direct\showbase\ShowBase.py", line 3313, in __doStartDirect
    self.startDirect(fWantDirect = fDirect, fWantTk = fTk, fWantWx = fWx)
  File "D:\pythonProject\venv\lib\site-packages\direct\showbase\ShowBase.py", line 3284, in startDirect
    self.direct = DirectSession.DirectSession()
  File "D:\pythonProject\venv\lib\site-packages\direct\directtools\DirectSession.py", line 54, in __init__
    self.manipulationControl = DirectManipulationControl()
  File "D:\pythonProject\venv\lib\site-packages\direct\directtools\DirectManipulation.py", line 12, in __init__
    self.objectHandles = ObjectHandles()
  File "D:\pythonProject\venv\lib\site-packages\direct\directtools\DirectManipulation.py", line 1077, in __init__
    self.xPostGroup = self.xHandles.find('**/x-post-group')
AssertionError: !is_empty() at line 315 of panda/src/pgraph/nodePath.cxx

Process finished with exit code 1

I tried to execute code out of virtual environment and got this error

d:\pythonProject>python main.py
Known pipe types:
  wglGraphicsPipe
(all display modules loaded.)
Traceback (most recent call last):
  File "d:\pythonProject\main.py", line 4, in <module>
    gameApp = Application()
  File "d:\pythonProject\ApplicationQuickPanel.py", line 11, in __init__
    ShowBase.__init__(self)
  File "C:\Python39\lib\site-packages\direct\showbase\ShowBase.py", line 520, in __init__
    self.__doStartDirect()
  File "C:\Python39\lib\site-packages\direct\showbase\ShowBase.py", line 3307, in __doStartDirect
    self.startDirect(fWantDirect = fDirect, fWantTk = fTk, fWantWx = fWx)
  File "C:\Python39\lib\site-packages\direct\showbase\ShowBase.py", line 3271, in startDirect
    self.startTk(fWantTk)
  File "C:\Python39\lib\site-packages\direct\showbase\ShowBase.py", line 3191, in startTk
    self.spawnTkLoop()
  File "C:\Python39\lib\site-packages\direct\showbase\ShowBase.py", line 3206, in spawnTkLoop
    Pmw = importlib.import_module('Pmw')
  File "C:\Python39\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'Pmw'

So I used command pip install Pmw, and after this I tried execute code again and it’s work out of virtual environment, so Inside virtual environment I keep with same error, but if we compare the output of pip list in virtual environment I have

(venv) D:\pythonProject>pip list
Package    Version
---------- -------
panda3d    1.10.8
pip        20.3.3
Pmw        2.0.1
setuptools 51.1.2

and out of virtual environment I have

d:\pythonProject>pip list
Package             Version
------------------- --------
cffi                1.14.3
numpy               1.19.3
panda3d             1.10.7
pip                 20.2.3
Pmw                 2.0.1
pycparser           2.20
PyOpenGL            3.1.5
PyOpenGL-accelerate 3.1.5
setuptools          49.2.1
vulkan              1.1.99.1

so as I though before the error happens because I miss some dependence, I don’t know exactly witch package, will install one each time and will post here later, maybe it can help someone.

After try install the packages in virtual environment I tried to execute the code and got the same error, so I noticed the version of packages, then I uninstall panda3d version 1.10.8 install version 1.10.7 and now its working

(venv) D:\pythonProject>pip list
Package    Version
---------- -------
panda3d    1.10.7
pip        20.3.3
Pmw        2.0.1
setuptools 51.1.2

But if I upgrade panda3d I got the same error, so I think the error is something internal to panda

I’m seeing the same on my end subsequent to upgrading to 1.10.8–and in a program in which I think that DirectTools previously worked. Thus I likewise think that this may indeed be a Panda-bug in 1.10.8.

It’s probably caused by this change:

Instead of downgrading to 1.10.7, I suggest changing the DirectManipulation.py file directly to undo that change.

1 Like