Accessing Vector Pass Data in python in background mode Background: We are building an automated pipeline to extract motion (i.e. vector pass output) from animated blends by running scripts using blender's python API. We are able to programmatically set up nodes and run rendering. We need access to full precision x,y motion components, and the only way we found of accessing that was via bpy.data.images['Viewer Node'].pixels. This gives correct output when running with GUI. 

Problem: We need to run blender in background mode on many examples, and in background mode bpy.data.images['Viewer Node'].pixels has a) wrong resolution (does not respect scene.render.resolution_x), b) wrong info (everything is zero).

Existing solutions: We know that it is possible to modify blender source code to fix this, but we want to open source our pipeline, and creating a custom blender build to run it might be too much of an impediment for people. We'd like to make this work with a standard blender version.

Questions: 


Is it possible to access vector pass data in some other way, without using the Viewer Node, so that rendering can be done in the background?
Or, is there a way to force Viewer Node to output correct data in background mode?
In the end the solution was to use multilayer EXR output by constructing a simple node graph automatically in python (Blender 2.78).

bpy.context.scene.use_nodes = True
bpy.context.scene.render.layers[0].use_pass_combined = True
bpy.context.scene.render.layers[0].use_pass_vector = True

tree = bpy.context.scene.node_tree
rl = tree.nodes.new('CompositorNodeRLayers')
rl.location = 0, 200

output = tree.nodes.new('CompositorNodeOutputFile')
output.location = 200, 200
output.format.file_format = 'OPEN_EXR_MULTILAYER'
output.base_path = output_folder

links = tree.links
links.new(rl.outputs['Speed'], output.inputs[0])