ipython

How do I embed IPython with working generator expressions?

Certain list comprehensions don't work properly when I embed IPython 0.10 as per the instructions. What's going on with my global namespace? $ python >>> import IPython.Shell >>> IPython.Shell.IPShellEmbed()() In [1]: def bar(): pass ...: In [2]: list(bar() for i in range(10)) --------------------------------------------------------...

What is causing ImportError: No module named pkg_resources after upgrade of Python on os X?

I just updated Python to 2.6.4 on my Mac. I installed from the dmg package. The binary did not seem to correctly set my Python path, so I added '/usr/local/lib/python2.6/site-packages' in .bash_profile pprint.pprint(sys.path) ['', '/Users/Bryan/work/django-trunk', '/usr/local/lib/python2.6/sit...

What are the best iPython tutorials?

I've been using iPython for a few months and I'm always learning new features. It seems that many of the features are hidden. What tutorials would you recommend to learn more iPython features? ...

How do I make set_printoptions(suppress=True) permanent?

In numpy there is a function that makes arrays print prettier. set_printoptions(suppress = True) In other words, instead of this: array([[ 0.00000000e+00, -3.55271368e-16, 0.00000000e+00, 1.74443793e-16, 9.68149172e-17], [ 5.08273978e-17, -4.42527959e-16, 1.57859836e-17, 1.35982590e-16, 5.599181...

Cannot make cProfile work in IPython

I'm missing something very basic. class C: def __init__(self): self.N = 100 pass def f(self, param): print 'C.f -- param' for k in xrange(param): for i in xrange(self.N): for j in xrange(self.N): a = float(i)/(1+float(j)) + float(i/self.N) ** float...

How to use IPython with IronPython

What is the procedure to get IPython to use IronPython as it's Python interpreter? I know there were previously some issues: http://stackoverflow.com/questions/1160501/what-is-required-to-use-ipython-in-ironpython But now that these issues should be fixed, how do i actually go about this? The install doesn't detect IronPython as a ve...

Autoreload of modules in iPython

Is there a way to have iPython automatically reload all changed code? Either before each line is executed in the shell or failing that when it is specifically requested to. I'm doing a lot of exploratory programming using iPython and SciPy and it's quite a pain to have to manually reload each module whenever I change it. ...

How to use ipython's IPShellEmbed from within a running doctest

Please help me get an embedded ipython console to run inside a doctest. The example code demonstrates the problem and will hang your terminal. On bash shell I type ctrl-Z and then kill %1 to break out and kill, since ctrl-C won't work. def some_function(): """ >>> some_function() 'someoutput' """ # now try to drop ...

how to use iPython

I could not understand the ipython library. This url provide the common feature but I could not core-relate it. http://ipython.scipy.org/doc/rel-0.9.1/html/interactive/tutorial.html How to I use IPython to improve my day to day python application experience? ...

iPython demo mode

I'm trying to use the iPython demo mode. I created a file called test.py containing: print 1 print 2 print 3 and then launched iPython and did the following: In [1]: from IPython.demo import LineDemo In [2]: d = LineDemo('test.py') In [3]: d() ********************* <test.py> block # 0 (5 remaining) ********************* p ********...

Any way to show error and backtrace with nosetests --pdb

Is there a way to get nosetests --pdb to automatically show you the error you're trying to debug, as well as a backtrace, BEFORE dumping you into pdb? i.e. instead of: awagner@hesse:/home/awagner/optimization/illumination_search$ nosetests --pdb test_bool_rep (optimization.illumination_search.test_subset_search.SubsetSearchTest) ... ok ...

How to switch to a python subprocess created by IPython (on OS X)?

When I use IPython along with the -wthread option, it spawns a python subprocess, which appears as a Mac OS X application. My problem is that when I send commands to that application (for example plotting with matplotlib), the window is updated behind all my other windows. I would like to be able to call a python command to switch this ...

Weird problem with input encoding in IPython

Hello! I'm running python 2.6 with latest IPython on Windows XP SP3, and I have two questions. First one of my problems is, when under IPython, I cannot input Unicode strings directly, and, as a result, cannot open files with non-latin names. Let me demonstrate. Under usual python this works: >>> sys.getdefaultencoding() 'ascii' >>> s...

Pipe output of a command to an interactive python session?

What I'd like to do is something like $echo $PATH | python --remain-interactive "x = raw_input().split(':')" >>> >>> print x ['/usr/local/bin', '/usr/bin', '/bin'] I suppose ipython solution would be best. If this isn't achievable, what would be your solution for the situation where I want to process output from various other comm...

print_r functionality in iPython

Is there a way to get PHP-like 'print_r(object)' funcionality in iPython? I know I can use '?' to get info about an object, but how do I view the values of the object? ...

Py3k and IPython

I'm moving on up to Python 3, but can't seem to find an IPython release for it. The main IPython release page doesn't list anything appropriate. Any help in getting IPython working for Py3k would be much appreciated. ...

iPython - single line spacing possible?

Hello, Is there any way to configure the iPython shell so that it does not produce a blank line between each command history? This would significantly increase the amount of historic I would be able to see on my screen. Thanks in advance, Thomas ...

Hide deprecated methods from tab completion

I would like to control which methods appear when a user uses tab-completion on a custom object in ipython - in particular, I want to hide functions that I have deprecated. I still want these methods to be callable, but I don't want users to see them and start using them if they are inspecting the object. Is this something that is possib...

Are there any iPython-like shells for Ruby or Rails?

I love iPython and am learning RoR along with some libraries like Mechanize and I'd like to be able to easily see what I'm working with in terms of introspection. I would like to be able to type "." + TAB and see. ...

matlab-like variable editor in python

is there a data viewer in python/ipython like the variable editor in MATLAB? ...