The manual only tells you to type
which is only true if all your paths are automatically set (this should happen at installation). You’re actually expected to know how to navigate with a command prompt to successfully use this and other of Panda’s command line tools.
[size=150]Here’s a quick HowTo for the windows command shell:[/size]
[color=darkblue]As example I’ll use ppython.exe here, but this HowTo is very usable for many other programs as well. See HERE for a list of executables whipped with Panda. Additional info on this topic at the end of this post.
A command shell is mainly meant for running programs. And except the programs you know, e.g. those you usually double-click like Firefox and Minesweeper, you can use a few more. Some of them don’t even open any new windows, but are run inside that black’n’white window. Then there are some commands that are shipped with Windows extra for command shell use only, like ‘cd’ or ‘help’ (there are many of those). There are others, but you won’t need too many here. Search the web for “windows command prompt” or something similar if you’re curious.
You start programs in the command shell by simply typing their names, or better said, the names of the executable files (ending with .exe most often), followed by Enter.
Current working directory
In the command prompt shell you always are in a certain folder (same as in folder explorer). Commands you type are expected to be either in the current working directory or in the windows folder. Third case are the built-in commands of the shell, which you can use from any directory.
Use the built-in command ‘cd’, which stands for ‘change directory’ to navigate to the directory that holds the application you want to start. In our case ‘ppython’, which most probably lies somewhere in ‘C:\Panda3d-1.7.1\python’ or so.
In that particular case you’d have to type
to get there.
The current directory you are in should be shown in the prompt meanwhile. A prompt is the short text that shows up in front of your blinking text-cursor, by the way.
While being in the directory that holds ‘ppython.exe’, you can simply type ‘ppython.exe’ to start that program (most probably you can omit the .exe extension, not sure here).
Ok, now the interactive Python console runs, but how to load your script now you might ask. Before we get there, let me explain two other things.
Relative and absolute paths
Above I said that the application you start is expected to be in the current directory. This is not the whole truth. Typing a file name tells the shell that the program is to be found relative to current directory. It’s the same as ‘.\ppython.exe’, while ‘.’ (a dot) stands for the current directory you’re in. Alternatively you can extend that relative path. Beside the dot (’.’), the windows shell also understands double dot (’…’), which stands symbolicaly for the parent directory. Let’s say you’re in the directory ‘C:\Program Files\Adobe’ and type ‘…\something.exe’. In this case the shell first goes to the parent directory, which is ‘C:\Program Files’ and looks for the invoked program there.
You surely notice that this kind of command invocation is depending in the current directory and it can take long to type all those pathways. This is where we introduce “absolute paths”. Instead of telling the shell where a program is as seen from the working directory, we can simply tell the way as seen from the root, which is a device name. Here’s an example invoking ppython.exe independent of your working directory: ‘C:\Panda3d-1.7.1\python\ppython.exe’.
Type that (without quotes), press enter, and you should be there the quick way.
Here’s a small comparison of four different ways to actually achieve the same:
Assuming you’re in C:\Users\yourname:
Command line arguments
The second thing that needs to be mentioned is command parameters. You already saw with the command ‘cd’ that it expects something after a space - a path in this case.
Many commands/programs expect such arguments, which often control a program. To know what command line arguments are allowed, most programs have a default argument like ‘/?’ or ‘-help’ which shows all others.
This line shows you a text explaining what you can do with the ‘cd’ command and how to use it.
The program ‘ppython.exe’ expects a python script name (with path, to be precise) as optional argument. If given, it will start that script immadiately.
So to start your script from Desktop you could theoretically use something like this:
(Assuming your current working directory is ‘C:\Users\Yourname’)
ppython.exe and python.exe are special cases, because you can start those from any directory. If your installation went all okay, you should be able to omit the
and start ppython.exe directly - like the manual describes it:
Other programs shipped with Panda3D like multify.exe, egg2bam.exe and many more (see HERE) need to be started as described in the HowTo above. Most of the applications from the list take ‘-help’ as argument. Use it to view detailed informations on how to actually use those treasures.
Hope this clarifies some confusion around how to use ppython and other Panda tools. Feel free to comment and criticize.