[IPython-user] more on edit magic problem
Fernando.Perez at colorado.edu
Mon May 16 17:41:33 CDT 2005
danny shevitz wrote:
> I have a guess as to what is going on with my edit magic not working.
> Remember I am on a windoze box.
> After I installed ipython I noticed a weird behavior I didn't think
> anything about. In a command prompt (not ipython) ctrl-z no longer
> works to raise SystemExit. Ctrl-z doesn't get me out of ipython either,
> BTW. So in order to get out of an interactive session I have to
> explicitly raise SystemExit. Well today, I was playing around and it
> turns out that ctrl-d works like it does on *nix. In other words,
> ctrl-d acts like the EOF character, not ctrl-z. I think, but can't be
> sure that when I installed ipython, somehow I got mapped over to *nix
> style keybindings. I have absolutely no idea how or where this could
> have happened, nor how to fix this.
> My current theory with the magic edit not working is that TextPad puts
> the normal EOF character at the end of the temp file, but the python
> interpreter is not interpreting it correctly.
> I have reinstalled python 2.3.5 and that didn't solve the problem.
> Hey, it just occured to me, I installed readline at the same time as
> ipython to make it work. Is there any chance that screwed me up?
Yes, the keyboard behavior you describe is a direct result of how readline
modifies things, to send EOF from a Ctrl-D (a la unix). HOWEVER, this should
have nothing to do whatsoever with the interpretation of EOF when reading a file.
I'm afraid to say that you might have to poke around the ipython sources
themselves a little to clarify the mistery. Try looking for magic_edit in
IPython/Magic.py. Around line 1800, look for the string 'done. Executing
edited code...', and start adding print statements here and there. This might
tell you which codepath is incorrectly being taken.
I'm sorry to do this to you, but since I can't reproduce the problem _at all_
on my machine, all I can do is point out at where you can do the debugging.
More information about the IPython-user