[IPython-user] ipython as zope interactive console

Jeff Kowalczyk jtk at yahoo.com
Tue Oct 5 14:33:48 CDT 2004

I wanted to start a thread to see what ideas are out there for configuring
ipython as the interactive python console when running 'zopectl debug'.

I read Fernando's forward of Jean Jordaan's tip on starting ipython within
the normal python environment. I wanted something direct, so I made a
slight alteration to the zope 2.7.2 source code:

+++ /usr/lib/zope-2.7.2/lib/python/Zope/Startup/zopectl.py 
@@ -164,7 +164,12 @@
         return cmdline + more + '\"'

     def do_debug(self, arg):
-        cmdline = self.get_startup_cmd(self.options.python + ' -i',
+        try:
+            import IPython
+            python = '/usr/bin/ipython'
+        except ImportError:
+            python = self.options.python
+        cmdline = self.get_startup_cmd(python + ' -i',
                                        'import Zope; app=Zope.app()')
         print ('Starting debugger (the name "app" is bound to the top-level '
                'Zope object)')

I'm sure the email client will mangle that; but the idea was simply to
substitute the ipython binary. It seems to work perfectly. 

- Should there be a ZConfig directive for interactive interpreter? Anyone
ever written one, and could it be an add-in product?

- What would be the best cross-platform way to find the correct ipython
binary? If a ZConfig directive is available, this point is moot.

- Effective user is a bit of a problem. IPython tries to write history,
etc. into /root/.ipython/ when it is no longer that (root) user.

On my setup, I start zope/zeo as root, and the system drops back to the
effective user zope:zope (user:group). ZEO seems to stay as root, it
doesn't have an 'effective user' directive, only 'user', although that may
have similar effects.

Long story short, ipython 'crashes' on exit. Although I think this is only
limited to shutdown procedures. It doesn't appear to bring down zope/zeo

- Lots of startup messages scroll by when starting a zeo client. It would
be good to have an option of supressing them in the console without
disturbing zope's config.

- Zope objects have *lots* of attributes! Any tips available for using the
code-completion and attribute exploration with massive lists of attributes
would probably help Zope newbies immensely.

Thanks for any input. I'm thrilled to be using ipython against a live zope
datbase, it really helps.

More information about the IPython-user mailing list