[IPython-user] IPShellEmbed only stops once

Dave Kuhlman dkuhlman@rexx....
Fri Jun 8 13:47:55 CDT 2007


I recently ran into the following problem -- If I run a program
that creates several calls to an embedded shell, when I type
Ctrl-D at the first break, it exits from the embedded shell, and
also automatically exits from all subsequent shells without
pausing.

Has anyone else run into this?  I looked for a flag in my
ipythonrc that might control this, but could not find anything.

Must be something simple that I'm doing wrong.  But, I can't
figure out what.

I'm on Ubuntu GNU/Linux using Python 2.5.1 and IPython 0.8.1.

Here are some things that I've done to try to fix this:

- I've tried running under several shells, for example Konsole
  (KDE), Eterm, and xterm, but get the same result.

- I installed the latest IPython (0.8.1).  I cleared out my
  ~/.ipython directory, to make sure that IPython installed the
  latest .ipythonrc.  I get the same result.

- I tried running my test (see below) with a different version of
  Python.  I get the same result.

- I checked the value returned by ipshell.get_dummy_mode().  It's
  zero, which means that it should enter the shell at each call to
  ipshell, right?

If anyone has a suggestion, I'd like to hear it.  Thanks in advance. 

Here is a simple test:

# ======================================
from IPython.Shell import IPShellEmbed
args = ['-pdb', '-pi1', 'In <\\#>: ', '-pi2', '   .\\D.: ',
    '-po', 'Out<\\#>: ', '-nosep']
ipshell = IPShellEmbed(args,
    banner = 'Entering IPython.  Press Ctrl-D to exit.',
    exit_msg = 'Leaving Interpreter, back to program.')

def breaks():
    ipshell('one')
    ipshell('two')
    ipshell('three')

breaks()
# ======================================

And here is the output:

# ======================================
Entering IPython.  Press Ctrl-D to exit.
one
In <1>:
Do you really want to exit ([y]/n)? y
Leaving Interpreter, back to program.
Leaving Interpreter, back to program.
Leaving Interpreter, back to program.
# ======================================

Notice that IPShellEmbed does not print a prompt and stop after
the first call to ipshell.

Dave


-- 
Dave Kuhlman
http://www.rexx.com/~dkuhlman


More information about the IPython-user mailing list