I am using the collective.python buildout.
I have the following .pythonrc (configured with export PYTHONSTARTUP=~/.pythonrc):
import readline
import rlcompleter
readline.parse_and_bind('tab: complete')
When I run Python in the shell, tab completion works. When I run Plone in debug mode it does not. Unless, I paste the contents of my .pythonrc into the Plone debug Python prompt. What am I missing here?
Note: Pasting the contents of my .pythonrc only works when I install Plone via python bootstrap.py (i.e. bootstrapping Plone buildout with collective.python Python). If I install Plone inside a virtualenv, nothing works. But at least in that scenario, the missing functionality makes sense to me (i.e. something is probably missing from the virtualenv that is required to make tab completion work.)
The instance controller uses two command-line switches;
-ifor interactive mode, and-cto load the Zope configuration and set up theappvariable. The-cswitch is what disables thePYTHONSTARTUPenvironment variable.You could modify the
plone.recipe.zope2instancepackage to run the script anyway.In
plone.recipe.zope2instance, find theplone/recipe/zope2instance/ctl.pyfile, alter thedo_debug()method to:In fact, I like the idea of supporting
PYTHONSTARTUPso much I committed that change to the recipe already, see rev 536f8fc1c4!