8 Jul 17:30
help with embedding
From: David M. Kaplan <dmk <at> ucsc.edu>
Subject: help with embedding
Newsgroups: gmane.comp.python.ipython.user
Date: 2008-07-08 15:31:12 GMT
Subject: help with embedding
Newsgroups: gmane.comp.python.ipython.user
Date: 2008-07-08 15:31:12 GMT
Hi, I am starting to use ipython as a replacement for matlab. I have been trying to use IPShellEmbed to create a "keyboard-like" command for ipython and have some problems/questions. keyboard is a command in matlab that you stick in a script that allows you to drop out of the script and into a manual entry state where you have access to the same namespace as the script and can look at and modify variables. As I understand, this is the purpose of IPShellEmbed (except for modifying variables, which I don't think it allows - correct me if I am wrong). However, I can't seem to get it quite right. I think I have also found some bugs, or at the very least some very strange behavior. First I generate an IPShellEmbed instance: from IPython.Shell import IPShellEmbed keyboard = IPShellEmbed(['-pi1','keyboard <\\#>'], \ 'Entering Keyboard','Exiting Keyboard') Then I use it with keyboard(). This basically works, but I have the following questions: 1) Calling keyboard() from ipython itself seems to drop me into a new namespace that doesn't know anything about the variables in the original ipython namespace. I can fix this by setting the local or global namespace to _ip.user_ns. Can someone explain why this is necessary? Naively, I would expect to end up in the ipython namespace just as calling keyboard() from a script does. 2) The restriction to not being able to modify variables is a bit of a(Continue reading)
RSS Feed