# How to interface with blender using IPython from terminal?

Is there any way to interface with blender using IPython in blender 2.68? I have tried many many options over the past couple of days and none of them have worked for me...

The best option for me would be if I could use IPython in the terminal I initiated blender with.

I have tried using IPython.embed with no success, and I also have tried this, but I can't get it to work with blender 2.68a.

Perhaps there is a way to start an instance of blender from within an IPython session?

• I don't know much about this, but from what I can tell, blender --python-console does what you want. – gandalf3 Sep 16 '13 at 23:02

Yes, simply run this in a text editor

import IPython
IPython.embed()


it's even in blenders official documentation.

### Note:

This will lock Blenders UI and prevent any redraws or user input while the console runs. You can start IPython in the terminal, execute some commands, then Ctrl+D, to exit the IPython and use Blender again.

There is no convenient way to avoid this.

• OK, I've tried running a script containing this at startup, but I get "RuntimeError: input(): lost sys.stdin" – user1276 Sep 16 '13 at 3:28
• @user1276, define "running a script containing this at startup", I tried saving these 2 lines in a script, then running: blender --python test_ipython.py and ipython gave me a prompt in the terminal I started blender from. – ideasman42 Sep 16 '13 at 3:41
• Yes, this is the command I tried exactly, except when I tried it with these two lines only I received "ImportError: No module named IPython". To solve this, I have three lines appending my local python site-packages to the blender python sys.path. I also included the lines mentioned in the documentation you linked to. – user1276 Sep 16 '13 at 4:42
• I tried it without the other lines from the documentation and am given a prompt, but now blender runs with a completely blank screen... When I ctrl-D out of ipython, blender loads the gui into the window... Any ideas, ideasman? :) – user1276 Sep 16 '13 at 4:43
• @user1276 "without the other lines from the documentation", Please try to be specific or it becomes hard to provide useful feedback. – ideasman42 Sep 16 '13 at 4:49