0

Trying to get up and running with Panda3D. I can't seem to get anything going with the ShowBase class.

I use the following code, as instructed by the website:

    from direct.showbase.ShowBase import ShowBase

class myApp(ShowBase):

    def __init__(self):
        ShowBase.__init__(self)

app = myApp()
app.run()

Now, when I go to test it, I get the following error:

Traceback (most recent call last):
  File "C:\Users\POWER\Documents\python_programs\panda3d.py", line 1, in <module>
    from direct.showbase.ShowBase import ShowBase
  File "C:\Users\POWER\AppData\Local\Programs\Python\Python37-32\lib\site-packages\direct\showbase\ShowBase.py", line 12, in <module>
    from panda3d.core import *
  File "C:\Users\POWER\Documents\python_programs\panda3d.py", line 1, in <module>
    from direct.showbase.ShowBase import ShowBase
ImportError: cannot import name 'ShowBase' from 'direct.showbase.ShowBase' (C:\Users\POWER\AppData\Local\Programs\Python\Python37-32\lib\site-packages\direct\showbase\ShowBase.py)

Using Windows 10, Python 3.7. Any help?

  • [This question may be related, or even an (indirect) duplicate](https://stackoverflow.com/questions/30506790/panda3d-error-no-module-named-direct-showbase-showbase-in-python-2-7). – 9769953 Jan 19 '19 at 21:36
  • I do note that you're using the 32-bit version of Python; any specific reason for that? You generally want to use the 64-bit version of Python and Panda3D. – rdb Feb 18 '19 at 22:30

2 Answers2

2

I had the same problem, I solved by renaming the files in the folder, they have not to be called with the same name of the library. I had a file called panda3d.py and it doesn't work, now i renamed it and it words. Try to change the name of your files

SmallDev
  • 21
  • 3
1

Check to see if you have Panda3D installed, if not then go the command prompt and type:
pip install Panda3D

Another error in your code is the indentation when importing ShowBase, try importing with any indentation.

from direct.showbase.ShowBase import ShowBase

If you have any further questions try checking the Panda3D Manual

Gerelen
  • 11
  • 2
  • I have already installed Panda3D, and even tried to install it again to make sure. The indentation was just a problem with the formatting when I posted this. – Ryan Dakin Jan 20 '19 at 16:33