[Bf-python] blender and external editors - workflow?

Dietrich Bollmann diresu at web.de
Fri Aug 20 16:31:54 CEST 2010


Hi Marc,

for the case that this might be helpful for you, here is my solution for
the same problem:

https://code.launchpad.net/~diresu/blender/blender-command-port-002

Cheers, Dietrich


PS:

I am using it from an external lisp program for the automatic generation
of shapes and together with emacs and emacs' python mode adapted to
blender, as I prefer emacs for editing code to any other editor.  The
python mode was assembled for my private use and - even if it works just
fine for me - it is very experimental:

https://code.launchpad.net/~diresu/blender-python-mode/blender-python-mode


On Fri, 2010-08-20 at 09:20 +0200, Marc Weber wrote:
> I'm a total blender noob - however I'd like to start with some
> scripting.
> 
> I've been programming various languages for years using Vim,
> so the builtin texteditor looks nice - but slows me down a lot.
> 
> So I tried hacking up a small client-server implementation which
> loads the python module on request.
> 
> Vim -> connects to python TCP/IP server running in Blender shell and
> loading the .py file -> Exceptions are feeded back into Vim Quickfix
> (error location list).
> 
> Code and usage are described in the short README.markdown file.
> http://github.com/MarcWeber/vim-addon-blender-scripting
> 
> However I have some trouble:
> When accepting connections using a background thread (so that the
> blender gui keeps being interactive) I get a failure:
> 
> >> AttributeError: 'NoneType' object has no attribute 'cursor_location'
> 
> caused by this line:
> cursor = context.scene.cursor_location
> 
> The same script (taken from the wiki) creates the meshes when run from
> blender editor.
> 
> Moreover somehow the code can make the console break. This happens on
> Exceptions or when sending the stop-server command.
> 
> >>>  print "abc"
> could not open socket
> 
> Traceback (most recent call last):
>   File "/nix/store/k406y5xmamxdbi9d8drwg3b0an0r457i-blender-2.53-beta/share/blender/2.53/scripts/op/console_python.py", line 122, in execute
>     is_multiline = console.push(line_exec)
>   File "/nix/store/rjkgdkc0r50avv4g8fgrn76l9gp5409m-python3-3.1.1/lib/python3.1/code.py", line 245, in push
>     more = self.runsource(source, self.filename)
>   File "/nix/store/rjkgdkc0r50avv4g8fgrn76l9gp5409m-python3-3.1.1/lib/python3.1/code.py", line 74, in runsource
>     self.runcode(code)
>   File "/nix/store/rjkgdkc0r50avv4g8fgrn76l9gp5409m-python3-3.1.1/lib/python3.1/code.py", line 90, in runcode
>     exec(code, self.locals)
>   File "<blender_console>", line 1, in <module>
>   File "/home/marc/mwr/vim-addon-blender-scripting/blender_server.py", line 59, in blenderServer
>     sys.exit(1)
> SystemExit: 1
> 
> This should be a syntax error
> 
> 
> So is this design impossible remote controlling python in blender asking
> it to execute .py files? Or is there a way to make this plugin /
> extension a success for most devs easily?
> 
> I'm running blender 2.53 beta on ( a customized ) Linux.
> 
> If this mail is totally off topic here - then point me to the correct
> channel,please. I've been overwhelmed by the list of mailinglist and
> picked the first having "python" in its name..
> 
> Marc Weber
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python





More information about the Bf-python mailing list