Ondrej Certik | 1 Jun 02:06
Picon
Gravatar

Re: start ipython from my own script

On Sat, May 30, 2009 at 8:19 PM, Gökhan SEVER <gokhansever <at> gmail.com> wrote:
> Ondrej,
>
> Do you know how to instantiate --pylab in the similar fashion (from a shell
> call and dropping into pylab enabled Ipython session) ?

Unfortunately I don't know, but try to investigate what the --pylab
option really does and then there are maybe some kwarguments how to do
it. Or just patch ipython to do it and send a patch.

To all --- I am using the following combination quite often now:

import IPython
IPython.Shell.IPShell(user_ns=locals()).mainloop()

would it make sense to create something like:

import IPython
IPython.set_trace()

or something similar, that would just execute the above line?

Ondrej
_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user
Ondrej Certik | 1 Jun 02:32
Picon
Gravatar

Re: start ipython from my own script

On Sun, May 31, 2009 at 6:06 PM, Ondrej Certik <ondrej <at> certik.cz> wrote:
> On Sat, May 30, 2009 at 8:19 PM, Gökhan SEVER <gokhansever <at> gmail.com> wrote:
>> Ondrej,
>>
>> Do you know how to instantiate --pylab in the similar fashion (from a shell
>> call and dropping into pylab enabled Ipython session) ?
>
> Unfortunately I don't know, but try to investigate what the --pylab
> option really does and then there are maybe some kwarguments how to do
> it. Or just patch ipython to do it and send a patch.
>
> To all --- I am using the following combination quite often now:
>
> import IPython
> IPython.Shell.IPShell(user_ns=locals()).mainloop()

Actually, to emulate pdb.set_trace(), I want to be able to access both
locals and globals, e.g. here is my line:

        IPython.Shell.IPShell(user_ns=dict(globals(), **locals())).mainloop()

I tried to implement this:

$ bzr diff
=== modified file 'IPython/__init__.py'
--- IPython/__init__.py	2009-03-17 03:05:22 +0000
+++ IPython/__init__.py	2009-06-01 00:29:16 +0000
@@ -59,6 +59,13 @@

 import Shell
(Continue reading)

Minjae Kim | 1 Jun 06:11
Picon
Favicon

sys.exc_info() equivalent for ipython

Hello,

If I have a buggy file called foo.py and run it in Ipython using
   %run foo.py
ipython will print out an error message.  I would like to somehow save this error message.
Hence, I would like something similar to sys.exc_info() in iPython. 

Any tip?

Best,
Minjae

_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user
Allen Fowler | 4 Jun 17:40
Picon
Favicon

IPShellEmbed & listing interactive namespace?


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
Gökhan SEVER | 5 Jun 06:25
Picon
Gravatar

Re: 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 <at> 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 <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user

_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user
Matthew Turk | 6 Jun 19:16
Picon
Gravatar

Pushing proxy objects

Hi there,

I'm trying to set up remote visualization of data via the
MultiEngineClient interface, using matplotlib.  What I'd really like
to be able to do is to push across the network a proxy object for a
local set of axes and figure and then allow the remote engine to
interact with a local object.

For instance, something like the following in the controller session,
to put proxies for local figs and axes on the remote clients:

local_fig = pylab.gcf()
local_ax = pylab.gca()

mec = MultiEngineClient()
mec.push_proxy("fig", local_fig, [0])
mec.push_proxy("ax", local_fig, [0])
mec.execute("some_plotting_command(fig, ax)", [0])

This would enable something like local visualization via the wxAgg
backend, while the remote compute node wouldn't necessarily have to
handle any of the GUI interaction.  I believe that all of the standard
arguments for the OO API in matplotlib are pickleable, so passing
*those* across the network should work.  The return values would be
trickier, but I suppose some subset of objects for common plotting
commands could be identified that would auto-proxy rather than
attempting to pickle, say, subplot axes.

Is something like this already possible with the IPython parallel
engine?  If not, any suggestions on where to start out?

Thanks very much!  As a side note, the IPython ipengine interface has
been great and very easy to set up and use for parallel analysis of
data.

-Matt
Allen Fowler | 8 Jun 19:25
Picon
Favicon

Re: IPShellEmbed & listing interactive namespace?

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 <at> gmail.com>
To: Allen Fowler <allen.fowler <at> yahoo.com>
Cc: ipython-user <at> 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 <at> 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 <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user


_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user
Gökhan SEVER | 8 Jun 19:31
Picon
Gravatar

Re: IPShellEmbed & listing interactive namespace?

On Mon, Jun 8, 2009 at 12:25 PM, Allen Fowler <allen.fowler <at> 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 <at> gmail.com>
To: Allen Fowler <allen.fowler <at> yahoo.com>
Cc: ipython-user <at> 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 <at> 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 <at> 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 :)
_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user
Norman Saez | 11 Jun 21:50
Picon

Change prompt during IPython session

Hi All:
I want to change the behavior of my prompt during the ipython session.

Is it possible do it in a simple way?

something like:

from IPython.Prompts import Prompt1
prompt = Promtp1(cache, sep='\n', prompt=r'MyPromp [\#]: ', pad_left=True)

Regards!
n.
Allen Fowler | 15 Jun 19:50
Picon
Favicon

fwiw: warning on Ubuntu 9.04


Am getting a "DeprecationWarning: the sets module is deprecated" on Ubuntu 9.04

Full log attached below:

(ipytest)afo <at> ubuntu:~/ipytest$ easy_install ipython
Searching for ipython
Reading http://pypi.python.org/simple/ipython/
Reading http://ipython.scipy.org
Reading http://ipython.scipy.org/dist
Best match: ipython 0.9.1
Downloading http://ipython.scipy.org/dist/ipython-0.9.1.tar.gz
Processing ipython-0.9.1.tar.gz
Running ipython-0.9.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-dDTwm0/ipython-0.9.1/egg-dist-tmp-w5Hv1p
/tmp/easy_install-dDTwm0/ipython-0.9.1/IPython/Magic.py:38: DeprecationWarning: the sets
module is deprecated
  from sets import Set
Adding ipython 0.9.1 to easy-install.pth file
Installing iptest script to /home/afo/ipytest/bin
Installing ipythonx script to /home/afo/ipytest/bin
Installing ipcluster script to /home/afo/ipytest/bin
Installing ipython script to /home/afo/ipytest/bin
Installing pycolor script to /home/afo/ipytest/bin
Installing ipcontroller script to /home/afo/ipytest/bin
Installing ipengine script to /home/afo/ipytest/bin

Installed /home/afo/ipytest/lib/python2.6/site-packages/ipython-0.9.1-py2.6.egg
Processing dependencies for ipython
Finished processing dependencies for ipython
(ipytest)afo <at> ubuntu:~/ipytest$ ipython
/home/afo/ipytest/lib/python2.6/site-packages/ipython-0.9.1-py2.6.egg/IPython/Magic.py:38:
DeprecationWarning: the sets module is deprecated
  from sets import Set
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) 
Type "copyright", "credits" or "license" for more information.

IPython 0.9.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: 

Gmane