Can't Run Panda3D

Hello!

I’m new to Panda3D and am trying to follow along the “Panda3D Hello World” tutorial but can’t get the following code to run.

from Panda3D.direct.showbase.ShowBase import ShowBase

class MyApp(ShowBase):

def __init__(self): #Defines a function called __init__
    ShowBase.__init__(self)

app = MyApp()
app.run()

Here is the error I get:

Traceback (most recent call last):
File “C:\Users\Ricky Vermeulen\Desktop\TTR-Mod\Panda3D_Practice.py”, line 1, in
from Panda3D.direct.showbase.ShowBase import ShowBase
ImportError: No module named Panda3D.direct.showbase.ShowBase

I’m using PyDev for Eclipse as my IDE. I’ve installed Panda3D SDK to a folder on my desktop and configured Eclipse to use ppython.exe as the interpreter which came with the Panda3D download. Not sure what else to try.

Thank you for any feedback!!! I’ll also attach a screenshot if that can help.


You need to configure PyDev to use the copy of Python that shipped with Panda, in the C:\Panda3D-x.x.x\python folder. I’m not sure how this is done, but I suggest looking in your project settings.
If it is already doing this, it is somehow not able to find the location of the Panda3D modules, so you would need to add C:\Panda3D-x.x.x to your module path (ie. PYTHONPATH / sys.path).

This is also true if you want it to use a different copy of Python. It does need to be the same version as the version of Python that Panda3D was compiled with, though.

Sorry, I did not read your post carefully enough. I now see you are using Panda3D.direct.showbase.ShowBase as the module name.

It is not standard to configure Panda3D this way. I strongly recommend that you instead place the Panda3D directory on your python module search path in your IDE’s configuration, so that you can import it the usual way, via “direct.showbase.ShowBase”.

That said, if you really wanted to use this nonstandard import structure, you would need to ensure that there is an empty init.py file inside the Panda3D directory, to make sure that it is recognised a valid Python package.