[Bf-python] Interfacing Blender with IPython

Campbell Barton ideasman42 at gmail.com
Thu Jun 28 18:17:57 CEST 2012


On Thu, Jun 28, 2012 at 3:14 PM, klo uo <klonuo at gmail.com> wrote:
> Hi,
>
> On Thu, Jun 28, 2012 at 1:58 PM, Campbell Barton wrote:
>> Answering the original mail:
>>
>> - Blender as a python module compiles blender headless, there is no
>> way to have the interface usable at the moment and probably wont be
>> added near term.
>> ... updated cmake description of this option so its more clear.
>>
>> - IPython embed:
>>>>> from IPython import embed
>>>>> embed()
>>
>> This works for me with no hanging/crashing, but it opens the terminal
>> in the terminal used to start blender (which you probably dont want).
>
> If it opens IPython console inside terminal where you started Blender,
> and you can interact with running Blender from within that IPython
> console then that would be great, and that's where I would like to
> get.
>
> So if that's true, can you tell me what kind of options you used to
> compile Blender, as my Blender simply hangs if I enter quoted lines in
> Blender Python console?

There is nothing special about my build environment, stock ubuntu
12.04 and arch linux - I've done this many times with bpython and
ipython, with old blender 2.4x, the game engine and more recently with
py3. this always worked fine.

Could you try this on a recent build? - if there is some crash it
would be good to get a backtrace.


>> So there are a few options...
>> - Make blenders python terminal a _real_ terminal, that uses
>> stdin/stdout, possibly emulates vt100 - this way we could get
>> embedding of any command line apps interactive stuff automatic.
>> ... for me this is too much work to do - but it is an option :S.
>>
>> - Go for some own-implementation, could extend the text editor for eg
>> to execute ipython functionality.
>> ... not a fan of this option but including since its been done before
>> and fairly straightforward.
>>
>> - Use the existing console but make use of ipython modules:
>> ... would involve editing ./release/scripts/modules/console_python.py
>> I think this is a fairly simple task - but to be added into blender we
>> would need to have it optional.
>>
>>
>> Last option is best imho - we may have even bundled ipython with
>> blender but at the time of writing the console ipython wasnt updated
>> to python3.
>>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python



-- 
- Campbell



More information about the Bf-python mailing list