5
$\begingroup$

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?

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

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.

$\endgroup$
  • $\begingroup$ OK, I've tried running a script containing this at startup, but I get "RuntimeError: input(): lost sys.stdin" $\endgroup$ – user1276 Sep 16 '13 at 3:28
  • $\begingroup$ @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. $\endgroup$ – ideasman42 Sep 16 '13 at 3:41
  • $\begingroup$ 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. $\endgroup$ – user1276 Sep 16 '13 at 4:42
  • $\begingroup$ 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? :) $\endgroup$ – user1276 Sep 16 '13 at 4:43
  • $\begingroup$ @user1276 "without the other lines from the documentation", Please try to be specific or it becomes hard to provide useful feedback. $\endgroup$ – ideasman42 Sep 16 '13 at 4:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.