ipython

Good way to edit the previous defined class in ipython

Hi, I am wondering a good way to follow if i would like to redefine the members of a previous defined class in ipython. say : I have defined a class intro like below, and later i want to redefine part of the function definition _print_api. Any way to do that without retyping it . class intro(object): def _print_api(self,obj): ...

How to use methods defined in a python scipt from a console like ipython.

Hello, I have written a python script with methods in it. Now I want to use methods from that script in ipython. How do I import it for use in ipython? Cheers ...

IPython tab completion not working

Tab completion on IPython seems not to be working. For example, import numpy numpy.<tab> simply adds a tab. import numpy num<tab> just adds a tab, too. Could you please suggest some possible causes for this problem? I am running Windows 7 and Python 2.6.5. ...

How to reload Django models without losing my locals in an interactive session?

I'm doing some research with an interactive shell and using a Django app (shell_plus) for storing data and browsing it using the convenient admin. Occasionally I add or change some of the app models, and run a syncdb (or South migration when changing a model). The changes to the models don't take effect in my interactive session even if...

How to embed a Python interpreter in a PyQT widget

I want to be able to bring up an interactive python terminal from my python application. Some, but not all, variables in my program needs to be exposed to the interpreter. Currently I use a sub-classed and modified QPlainTextEdit and route all "commands" there to eval or exec, and keep track of a separate namespace in a dict. However th...

A Python IDE with Debugging and iPython Integration?

Does anyone know of a python IDE that has iPython as the interpreter? Using the standard interpreter just drives me nuts, as I've just grown to love using iPython and all the features it provides. To be honest, I'd rather code with a simple text editor + ipython than an IDE, but I love being able to set breakpoints with a click of a ...

Prevent Python from caching the imported modules

While developing a largeish project (split in several files and folders) in Python with IPython, I run into the trouble of cached imported modules. The problem is that instructions import module only reads the module once, even if that module has changed! So each time I change something in my package, I have to quit and restart IPython....

What is the correct configuration for %autoreload in a Django ipython shell?

Ipython has a plugin called autoreload that will presumably reload all your modules after every command, so you can change the source and not have to quit the shell and reenter all your commands. See http://dsnra.jpl.nasa.gov/software/Python/tips-ipython.html for example. However, this seems flaky at best when using it with Django, e....

How to start a Python ipython shell, automatically run inside it a few commands, and leave it open?

I tried echo "print 'hello'" | ipython Which runs the command but ipython immediately exits afterwards. Any ideas? Thanks! Edit: I actually need to pass the command into the interactive Django shell, e.g.: echo "print 'hello'" | python manage.py shell so the -i switch gimel suggested doesn't seem to work (the shell still exits af...

IPython with own scope?

Hi all, I encountered a problem with the scope variables have when IPython is invoked at the end of a python script. All functions I call in the script itself can modify variables, which will subsequently be used by other functions. If I call the same functions in ipython, the scripted ones can access the changed variables but variables...

Search inside ipython history

ipython's %his command outputs recent commands entered by the user. Is it possible to search within these commands? Something like this: [c for c in %history if c.startswith('plot')] EDIT I am not looking for a way to rerun a command, but to locate it in the history list. Of course, sometimes I will want to rerun a command after locat...

Error in IPython Shell

I've just started playing around with IPython, and it's got some pretty cool features. I especially like that it "remembers" input from previous shell sessions. I am having some trouble, however, with the tab completion. Here's an example of my console: In [5]: a.__class__.python(58387,0x7fff70630c20) malloc: *** error for object 0x10...

iPython - "broken" shell/terminal after realoading Django

I'm embedding iPython shell in a Django script (with development server, e.g. runserver at localhost) like this: ... from IPython.Shell import IPShellEmbed ipshell = IPShellEmbed() ipshell() ... which gives me interactive shell at the desired place. Now, if modify the source code, Django automatically reloads, probably without correct...

color plot animation with play, pause, stop cabability using Tkinter with pylab/matplotlib embedding: can't update figure/canvas ?

I've looked but didn't find previous questions specific enough, so sorry if this is repeated. Goal: GUI to continuously update figure with different matrix data plotted by pylab's pcolor such that there is a running animation. But user should be able to play, pause, stop animation by Tkinter widget buttons. Before I get an answer for ma...

Best way to handle reload-ing of objects, not modules

Hi, I'm doing a lot of development in IPython where In[3]: from mystuff import MyObject and then I make lots of changes in mystuff.py. In order to update the namespace, I have to do In[4]: reload(mystuff) In[5]: from mystuff import MyObject Is there a better way to do this? Note that I cannot import MyObject by referencing mystuff...

Django manage.py doesn't work with IPython

I am on MacOSX Snow Leopard and I'm using python 2.6.5 installed with macports. I'm inside a virtualenv. I can't run python manage.py shell after installing IPython but I can run IPython standalone. I figured out that the following line is what causes the issue: (status, result) = commands.getstatusoutput("otool -L %s | grep libedit" %...

Start ipython running a script

My use case is I want to initialize some functions in a file and then start up ipython with those functions defined. Is there any way to do something like ipython --run_script=myscript.py? ...

Python3k replacement for IPython?

So, I'm a huge IPython fan, though I'm sure I don't use nearly all the power it has (mainly tab completion and ? for introspection, though I also use %ed a fair amount). However, I want to really start working with Python3k, and as this thread states, I'll need a Snickers to tide me over til IPython is ported. So what are my options fo...

quitting ipdb produces a really long error message

if I run this... import ipdb print 'a' ipdb.set_trace() print 'b' and then type 'q' to quit I get a 300 line error message. python 2.5.4 on windows. > d:\python25\scripts\a.py(4)<module>() 2 print 'a' 3 ipdb.set_trace() ----> 4 print 'b' ipdb> q ERROR: An unexpected error occurred while tokenizing input The following tracebac...

Running external commands in IPython

I'd like to run a new command from IPython configuration and capture its output. Basically, I'd like to access the equivalent of !command via normal functions. I know I can just use subprocess, but since IPython already provides this functionality, I guess there must be a properly made wrapper included somewhere in the API. ...