0
$\begingroup$

screen shot

I'm want very many camera working rendering test (maybe 60 count(camera animation)?

so my python code check please

enter code here
import bpy
i = 1
count = range(0, 2)
cam = "Camera.00"
for i in count:
    camname=cam + str(i)
    bpy.context.scene.camera = bpy.context.scene.objects[camname]
    print(bpy.context.scene.camera)
    bpy.data.scenes.render.filepath ="//TMP/" + cam + str(i) + ".jpg"
    bpy.ops.render.render(animation = True , write_still = True )
    i = i+1
$\endgroup$
1

1 Answer 1

4
$\begingroup$

Cannot run bpy.ops.text.run_script() from the console.

Operators prefixed bpy.ops.text. are designed to run in the context of the text editor. (eg press the run script button in the text editor) In which case the script to run is the one that you are looking at and is assigned to that areas space data

>>> C.screen.areas[3].type
'TEXT_EDITOR'

>>> C.screen.areas[3].spaces.active.text
bpy.data.texts['Text.001']

Hence when translated to english the error you are seeing is

>>> bpy.ops.text.run_script(
run_script()
bpy.ops.text.run_script()
Run active script
>>> bpy.ops.text.run_script()
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "/home/batfinger/blender-git/xxx/bin/2.91/scripts/modules/bpy/ops.py", line 202, in __call__
    ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.text.run_script.poll() failed, context is incorrect

https://blender.stackexchange.com/search?tab=votes&q=%5bpython%5d%20incorrect%20context

Run the script from the text editor, or paste it into python console to run from console. [Note to self. Find link for run script in console addon]

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .