Reputation: 1
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?
Upvotes: 0
Views: 928
Reputation: 21
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
Upvotes: 2
Reputation: 11
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
Upvotes: 1