Separate Python Installation

Hi. I already have Python installed, and want to use my main copy of Python, because that’s where I keep my existing programs. How can I set Python up so that I can open a Panda program in IDLE, as with any other .py file, and run it? Right now when I try it, I get the error:

Traceback (most recent call last):
  File "C:\Panda3D\samples\GreetingCard\GreetingCard.py", line 1, in ?
    import direct.directbase.DirectStart
ImportError: No module named direct.directbase.DirectStart

…Indicating that it can’t find Panda at all. When going manually to C:\Panda3D\examples\GreetingCard and typing “ppython GreetingCard.py”, that works fine.

All you need to do is tell your copy of python where the panda libraries are. It needs to be able to find the main panda directory, and also the bin directory. Usually, the easiest thing to do is create a “panda.pth” file in your python directory, containing paths like these:

c:\panda3d-1.2.1
c:\panda3d-1.2.1\bin

Oh, and don’t forget - the current version of panda is compiled for python 2.4

  • Josh

Thanks. I’ve got Panda in C:\Python\Panda3D and Python in C:\Python, so I created “panda.pth” in C:\Python, containing the lines:

C:\Python\Panda3D
C:\Python\Panda3D\bin

And now the error is:

DirectStart: Starting the game.
Warning: DirectNotify: category 'Interval' already exists
Traceback (most recent call last):
  File "C:\Python\Panda3D\samples\GreetingCard\GreetingCard.py", line 1, in ?
    import direct.directbase.DirectStart
  File "C:\Panda3D\direct\src\directbase\DirectStart.py", line 4, in ?
  File "C:\Panda3D\direct\src\showbase\ShowBase.py", line 192, in __init__
  File "C:\Panda3D\direct\src\showbase\ShowBase.py", line 501, in openDefaultWindow
  File "C:\Panda3D\direct\src\showbase\ShowBase.py", line 562, in openMainWindow
  File "C:\Panda3D\direct\src\showbase\ShowBase.py", line 391, in openWindow
  File "C:\Panda3D\direct\src\showbase\ShowBase.py", line 334, in makeDefaultPipe
  File "C:\Panda3D\direct\src\directnotify\Notifier.py", line 122, in error
StandardError: No graphics pipe is available!
Your Config.prc file must name at least one valid panda display
library via load-display or aux-display.

Did you move some DLLs? Panda uses relative paths to find some of its files. If you move the DLLs, it will get confused.

Make sure you didn’t transfer any of the panda DLLs out of the panda bin directory.

No, but I got it working. I moved Panda from being a subdirectory of Python back to its own directory, C:\Panda3D, and changed the panda.pth to reflect this. So, thanks!

Summary:
Problem:
I have a separate installation of Python I want to use.
Solution: Create a text file, “panda.pth,” in your Python directory containing the following lines:

C:\Panda3D
C:\Panda3D\bin

Where “Panda3D” is whatever your Panda directory is called. This lets Python know where to find the needed libraries. You should now be able to open and run Panda programs in IDLE just like any other Python code.

Huh… that’s not good. I wonder what went wrong? Let me debug.