Source inspector
The .pythonrc.py is the script that executes when interactive interpreter starts up. You need to unsure that an environment variable PYTHONSTARTUP contains the path to that file.
export PYTHONSTARTUP=/home/partecs/.pythonrc.py
Here is a handy code snippet that one could add into your .pythonrc.py file.
import pydoc
import inspect
import rlcompleter, readline
readline.parse_and_bind('tab: complete')
def source(obj):
"""source of the obj."""
try:
pydoc.pipepager(inspect.getsource(obj), 'less')
except IOError:
pass
Now for the fun part, run the Python interpreter and hit the tab button twice. You have the tab complete feature. Also try out the following statements.
>>> import os >>> source(os)
You should be able to view the source of the os module.
You can also use your pythonrc.py file in Zope’s debug mode. To start up Zope’s debug mode run the following statement.
./zope/instancehome/bin/zopectl debug
On the interpreter run the following statement.
>>> execfile('/path/to/.pythonrc.py')
If you don’t like running execfile everytime you run Zope in the debug mode you could simply edit and modify
lib/python/Zope2/Startup/zopectl.py and replace the line
"import Zope2; app=Zope2.app())" with
"import Zope2; app=Zope2.app(); execfile('/home/partecs/.pythonrc.py')".