Do you find yourself doing this all the time?
$ export PYTHONPATH=$PYTHONPATH:/path/to/some/package
If so, then save yourself some keystrokes! Just put the following into your .bash_profile:
function pypath {
if [ "$1" = "" ]; then
export PYTHONPATH=$PYTHONPATH:`pwd -P`
else
export PYTHONPATH=$PYTHONPATH:`pushd -n $1; pwd -P; popd -n`
fi
echo $PYTHONPATH
}
Now just type “pypath” inside any directory, and it gets appended to your PYTHONPATH. If you type “pypath /some/other/dir”, then that directory will get appended to your PYTHONPATH. Easy!