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

Marc Weber marco-oweber at gmx.de
Fri Aug 20 09:20:20 CEST 2010


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



More information about the Bf-python mailing list