PPython

I was wondering how much PPython.exe differs from the regular Python.exe for 2.4.2? I use an enhanced python shell (IPython), and I really like some of the additional functionality. Are the changes small enough that I could make those edits to my own Python, or are they rather complex edits?

Hamled,

ppython is a wrapper executable. If you look at the source code at:

direct\src\directbase\ppython.cxx you should be able to duplicate what it does.

Here’s some excerpts:

// Ask windows for the file name of this executable.

// Make sure that the executable’s name ends in LINK_SOURCE

// See if we can find the panda root. If not, abort.

// Set the PYTHONPATH and PATH

// Fetch the command line and trim the first word.

// Append LINK_TARGET to the file name.

// Calculate MODCMD

// Run it.

I left out the actual code of course but you can get the rest from the ppython.cxx file.

Steve

There is a paper on the Python site about the Panda3D engine:
python.org/pycon/dc2004/papers/29/

Section 3 contains some information about the relationship of Python and Panda and C++ through Interrogate.
It may not be the in-depth infor you are looking for, but it may be a good start.

“ppython” is trivial. All it does is make sure that the panda libraries are in the python path, and then it runs python.

It’s effortless to set up a regular copy of python to use panda. You just have to put the panda libraries in a place where python can find them. However, be careful to use the right python version number - panda is a C++ library, which means it is linked with a specific version of python. If you use the wrong version, it won’t work.

  • Josh

Aye, thanks. All I really needed to do was add to sys.path. Previously I guess I had just missed the pandadir\bin and pandadir\lib.

Hey Guys,
I am currently working with IronPython. From the ironPython interperter
I tried the doing --> import direct.directbase.DirectStart

I got this error:
"
ImportError: No module named direct.directbase.DirectStart
"

before I tried this, I added:
"
sys.path.append(r"C:\Panda3D-1.2.3\lib")
sys.path.append(r"C:\Panda3D-1.2.3\bin")
"
to IronPython’s ‘site.py’

Can anyone tell me what I must add to the sys.path to get panda running
from IronPython?

With regards,
Mez

Hi Mez,

You sure about that r in the sys.path command in between the ( )? doesn’t look right.

Steve

one problem i see with

sys.path.append(r"C:\Panda3D-1.2.3\lib") 
sys.path.append(r"C:\Panda3D-1.2.3\bin") 

is the usage of the escape symbol (’’) in a string, try:

sys.path.append(r"C:\\Panda3D-1.2.3\\lib") 
sys.path.append(r"C:\\Panda3D-1.2.3\\bin") 

on the other hand, i’m not sure if that will help alot, because IronPython is a different implementation of Python (using C#) and that might not be able to use a C++ library created for CPython (the standard Python using C). you might try though, i’m no expert about IronPython internals. good luck.

kaweh

Hey kaweh,
When I checked sys.path the paths did have ‘\’ so it looks like it changed them. I tried anyways and it didnt work.

any other ideas?

thanks,
mez

Post removed because I was wrong… see below from Kaweh.

nope, the string suffix ‘r’ is definitely a Python thing. given that fact and because i missed the ‘r’ in reading the example, my tip using \ was useless. :slight_smile:

see docs.python.org/ref/strings.html

mez, i’m quite sure that Panda3D can’t be used with IronPython (though i might be still wrong).

Panda3D is using CPython’s (the Python interpreter version you can download from www.python.org) extension API; IronPython is a totally different implementation of Python (Python the language) using C#. like Jython (the Python language implementation done in Java). all three implement Python (the langage), but using different host languages and thus different APIs for extending these implementations.

you might want to ask the IronPython people if it’s possible though, but i believe they will give you a similar answer. nevertheless it’s a good idea to check with them, i have not much knowledge of IronPython.

is there a reason you need to use IronPython (though IronPython for Windows development looks intriguing - i’m more of a platform agnostic person myself)? CPython (or the included Python with the Panda3D release) will run on Windows and currently you can refer to them as the reference implementation of the Python language.

i hope that helps somehow. sorry i can’t help with your original problem.

cheers,
kaweh

Interesting, never used that before. Thanks for pointing it out!

You learn something new everyday :slight_smile:

Steve

Maybe this should be put in the manual. In other words how to write C++ libs for Panda3D. By the way is there a searchable .chm file of the Panda3d API. Does not have to be .chm but something the can be used offline and that is seachable for specific classes, attributes and method explanations.

You can download the manuals from the “download/software” page. It’s pretty easy to search, using “grep” or windows search, once you’ve downloaded them.

Oh I have the ‘manual’ in both .chm and pdf format. What I was looking for was the API reference in a seachable format

You can download that too.

Ok I trust what you say but now tell me where. I know the API docs are on line here but WHERE are then in DOWNLOADBLE AND SEARCHABLE format Like .chm or at least pdf?

If I’m right they are in “Download”->“Software”->“Panda3D manuals” reference.zip

Thank you Martin. I found it. Now if I can just fine htmltohelp.exe I will try at some time in the future (Translation is do not hold your breath waiting for me to do this) convert the html files to a chm file and post it