[IPython-user] IPShellEmbed & listing interactive namespace?

Gökhan SEVER gokhansever@gmail....
Mon Jun 8 12:31:20 CDT 2009


On Mon, Jun 8, 2009 at 12:25 PM, Allen Fowler <allen.fowler@yahoo.com>wrote:

> Hello,
>
> Thank you for the help.
>
> A question:
>
> What does this code work:
>
> import IPython
> shell = IPython.Shell.IPShell(user_ns=locals())
> import app_modules
> #And lot's of other setup
> a = 5
> shell.mainloop()
>
> And this code does not:
>
> import app_modules
> #And lot's of other setup
> # (Before creating shell)
> import IPython
> shell = IPython.Shell.IPShell(user_ns=locals())
> a = 5
> shell.mainloop()
>
>
> ------------------------------
> *From:* Gökhan SEVER <gokhansever@gmail.com>
> *To:* Allen Fowler <allen.fowler@yahoo.com>
> *Cc:* ipython-user@scipy.org
> *Sent:* Friday, June 5, 2009 12:25:29 AM
> *Subject:* Re: [IPython-user] IPShellEmbed & listing interactive
> namespace?
>
> Hi,
>
> Try these snippets and do a whos() in IPython:
>
> import IPython
> shell = IPython.Shell.IPShell(user_ns=locals())
> a = 5
> shell.mainloop()
>
> Gökhan
>
>
> On Thu, Jun 4, 2009 at 10:40 AM, Allen Fowler <allen.fowler@yahoo.com>wrote:
>
>>
>> Hello,
>>
>> I would like to use IPShellEmbed to let users tinker with the internal
>> state of my application.
>>
>> After dropping them to the shell, what is the best way to give the users a
>> list of currently available objects/names/modules?
>>
>> %who does not seem to be working as expected, and locals() is littered
>> with ipython internal stuff.
>>
>> Thank you,
>> Allen
>>
>>
>>
>>
>>
>> _______________________________________________
>> IPython-user mailing list
>> IPython-user@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-user
>>
>
>
>
Because in the second case imports will not be visible to IPython. Can you
exit() from IPython using that method? I say 'y' but it doesn't let me exit,
very interesting :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20090608/21c82191/attachment.html 


More information about the IPython-user mailing list