<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="generator" content="Osso Notes">
    <title></title></head>
<body>
<p>Quick question: what are you trying to do? Can you avoid using operators and just do it using bpy.data?
<br>On Wed May   2 2012 07:59:45 AM EDT, Rodrigo Benenson <<a href="mailto:rodrigo.benenson@gmail.com">rodrigo.benenson@gmail.com</a>> wrote:
<br>
<br>> Dear Blender mailing list,
<br>> 
<br>> I just spent 3 hours on the blender IRC trying to figure out how to
<br>> automate a specific task using a python script called via "blender
<br>> --python script.py".
<br>> 
<br>> The purpose of the script is to open a blender file, apply some
<br>> operations and save the new blender file.
<br>> This must be done without any click from the user, so that the process
<br>> can be called via command line (i.e. as part of a bigger system).
<br>> 
<br>> Quite rapidly I entered into "context hell" trying to figure out the
<br>> proper context to call "bpy.ops.graph.select_all_toggle();
<br>> bpy.ops.graph.sample()".
<br>> The answer to this was "the_scene.objects.active = the_object;
<br>> bpy.context.area.type='GRAPH_EDITOR' " (found by someone in the IRC 2
<br>> hours after my first attempt).
<br>> 
<br>> The key problem now is that when running via   "blender --python
<br>> script.py" bpy.context.area is None, this seems to be a consequence of
<br>> bpy.context.window being None.
<br>> 
<br>> > From what I could gather in the IRC, no one is aware of a method to
<br>> create a new window (or setup properly the bpy.context.area) from
<br>> python.
<br>> In this case the documentation is of no help (it does not even mention
<br>> bpy.context.area).
<br>> 
<br>> Being able to launch automated tasks via "blender --python script.py"
<br>> seems like a natural usage of this feature, and has multiple use
<br>> cases.
<br>> 
<br>> Does any one have a suggestion/idea on how we could make this work ?
<br>> 
<br>> Thanks for your input.
<br>> Best regards,
<br>> rodrigob.
<br>> _______________________________________________
<br>> Bf-python mailing list
<br>> <a href="mailto:Bf-python@blender.org">Bf-python@blender.org</a>
<br>> <a href="http://lists.blender.org/mailman/listinfo/bf-python">http://lists.blender.org/mailman/listinfo/bf-python</a>
<br><br></p>
</body>
</html>