Alex Rivera | Logout

how to integrate ZSH and (i)python?

Asked 2009-06-10T03:11:55.320
12

I have been in love with zsh for a long time, and more recently I have been discovering the advantages of the ipython interactive interpreter over python itself. Being able to cd, to ls, to run or to ! is indeed very handy. But now it feels weird to have such a clumsy shell when in ipython, and I wonder how I could integrate my zsh and my ipython better.

Of course, I could rewrite my .zshrc and all my scripts in python, and emulate most of my shell world from ipython, but it doesn't feel right. And I am obviously not ready to use ipython as a main shell anyway.

So, here comes my question: how do you work efficiently between your shell and your python command-loop ? Am I missing some obvious integration strategy ? Should I do all that in emacs ?

Edit
Report

1 Answer

12

I asked this question on the zsh list and this answer worked for me. YMMV.

In genutils.py after the line

if not debug:

Remove the line:

stat = os.system(cmd)

Replace it with:

stat = subprocess.call(cmd,shell=True,executable='/bin/zsh')

you see, the problem is that that "!" call uses os.system to run it, which defaults to manky old /bin/sh .

Like I said, it worked for me, although I'm not sure what got borked behind the scenes.

answered 2009-07-01T18:19:24.940

Your Answer