Passing python command line options

I’m trying to pass a few values to a python script using the Blender command line; normally, if I were just running from the shell, I might use

python 1 2 3

and retrieve [,1,2,3] from sys.argv. When calling a Python script from the Blender command line, I’m unable to get it to parse additional command-line options to the Python script (whew!):

blender some.blend -P 1 2 3

doesn’t work.

Has anybody figured out a workaround?


Dont think theres any way around this…
Maybe “ 1 2 3” ??

This might be an answer (I haven’t tried it):

To pass parameters to the script you can:

  •      write them to a file before running Blender, then make your          script parse that file;
  •      set environment variables and access them with the 'os'          module:Examples with parameters being passed to the script via command      line: # execute a command like:

myvar=value blender -P

and in access myvar with os.getenv

(os.environ and os.setenv are also useful):

import os
val = os.getenv(‘myvar’)

To pass multiple parameters, simply write them in sequence,

separated by spaces:"

myvar1=value1 myvar2=value2 mystr=“some string data” blender -P

What are you trying to do? - it may be that we can make blender its self read in the settings if its a common enough thing,

Ideally, here’s what I’m trying to do:
Launch a script from Blender that spawns 4 separate background processes that migrate to an openmosix cluster

Each process would render one vertical strip of a still image (via border render)

The parent script would then combine the resulting strips into a single image (Blender compositor? GIMP?)

I saw your Renderfarm script on here, an I thought it might be possible to make things a little simpler with OM’s automigration; the problem I’m having is that I can’t get processes spawned/forked in Python to migrate reliably.


interesting, what values would you pass to the renderer, Well probably add in boarder render options as command args in normal Blender for 2.43 if thats what your interested in.


That was the idea:) I’ll post something if it seems like a viable script. I haven’t looked at the compositor at all - any suggestions where to start?


Iv herd that blender has minimal gains from openMosix on blendercoders, but I have no idea :wink:

Best split the frames of the animation up. or devide into tiles. if we can get deviding into tiles into blenders comment line args then thats realy easy to do in the shell.
An alternative is to geterate a python script for every tile- it woulent need to be very big. - that would work in place of args to python direct.
Or as the doc suggests, use env variables.