restoring the default completer in IPython

M

Michele Simionato

This should probably go to the IPython list, but since I am not
subscribed I will try my luck here.
Basically, I want to embed IPython inside a command line interpreter
based on cmd.Cmd, in this
way:

import cmd, IPython

class Cmd(cmd.Cmd):
def do_ipython(self, arg):
ipython = IPython.Shell.IPShellEmbed()
ipython(global_ns=globals())
def do_EOF(self, arg):
return 1

Cmd().cmdloop()

It works, however when I exit from the IPython shell (after giving the
ipython command) the Cmd
class is still using the IPython readline completer, not the original
one. By looking at the source
code of IPShellEmbed I see that there is a
method .restore_system_completer() which is
called, but it seems to be not working. I am probably doing something
wrong, can somebody knowledgeable on IPython internals share some
light on that? TIA,

Michele Simionato
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top