Before running a PI python script you need to set few environment variables as the LD_LIBRARY_PATH and the PYTHONPATH.
If you are using scram, and you have already created your PI project Workspace (see Getting Started with PI ) you just need to do :
eval `scram runtime -sh` (for Bash shell)
or for csh/tcsh shell :eval `scram runtime -csh`
Otherwise, outside scram, but with access to /afs/cern.ch , you can run the following scripts, which you can download from the links.. prepare.sh (for Bash shell)
source prepare.csh (for csh/tcsh )