[IPython-dev] Runtime Console Using IPython

Ivan Zhang mirage007 at gmail.com
Mon Sep 8 20:34:46 EDT 2014


Nice, that worked, thanks!


On Sun, Sep 7, 2014 at 9:25 PM, Thomas Kluyver <takowl at gmail.com> wrote:

> You set shell.user_ns after initialising the kernel (and hence the
> InteractiveShell object). Try passing in the namespace as user_ns when you
> instantiate the kernel.
>
> Thomas
>
> On 7 September 2014 18:00, Ivan Zhang <mirage007 at gmail.com> wrote:
>
>> Thanks for the tips, I actually saw that as well while I was making this.
>> My end goal for this tool is to facilitate remote access/monitoring of an
>> application without requiring other users to install something while
>> requiring minimal modification of the original application.
>>
>> 1.I actually think that's one of the keys to the notebook's success. So
>> as the next step, I was interested in exploring how to make a watered down
>> version of ipython's notebook that just had the web console part. Are there
>> any examples of this sort?
>>
>> I tried looking at the notebookapp.py and it just seemed too daunting to
>> dig through. On the other hand, I made a tiny example using
>> BlockingKernelClient (
>> https://github.com/mirage007/rtconsole/blob/master/rtclient.py)
>>  to connect to an instance, but the messages i got back were very verbose.
>>
>> Lastly, as I mentioned in the post, there is an issue where I cannot
>> define functions that uses variables that are supposedly already defined in
>> the user namespace.
>>
>> i.e. in the ipython console, if i type:
>>
>> >>> hello = lambda x: t+ 5
>>
>> where t was defined in the original application locals()
>>
>> it would give me an error:
>>
>> "global name 't' is not defined"
>>
>> Any idea of how to resolve this?
>>
>> Thanks,
>>
>> -Ivan
>>
>> On Saturday, August 30, 2014, Fernando Perez <fperez.net at gmail.com>
>> wrote:
>>
>>> Hi Ivan,
>>>
>>> On Sat, Aug 30, 2014 at 6:36 PM, Ivan Zhang <mirage007 at gmail.com> wrote:
>>>
>>>> Hi All,
>>>>
>>>> As a way to familiarize myself with IPython, I wrote a simple tool that
>>>> allows an IPython Kernel to be run as part of a thread, effectively
>>>> creating a way to remotely monitor and change the state of a running
>>>> application in real time.
>>>>
>>>
>>> Great! Thanks for sharing that... I'm sorry that I haven't looked at
>>> your code in detail, but along those lines, I thought at least it would be
>>> useful to point you to these examples:
>>>
>>> https://github.com/ipython/ipython/tree/master/examples/Embedding
>>>
>>> They illustrate how to embed a kernel in a process that may have its own
>>> event loop (Qt and Wx provided), and how to connect to it from an external
>>> Qt console, with both the Qt console and the GUI controls manipulating the
>>> same namespace.
>>>
>>> It's a different take on the same kind of ideas, and you may find it
>>> useful.
>>>
>>> Cheers
>>>
>>> f
>>>
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>


-- 
Ivan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140908/010216e7/attachment.html>


More information about the IPython-dev mailing list