Page MenuHome

Python Console Editor, bpy.ops exercise doesnt work
Closed, ResolvedPublic

Description

Im over here reading the Blender 2.76 manual
and the last exercise on this page doesnt work

https://www.blender.org/manual/editors/python_console.html

Event Timeline

eroMoD (tostrong4you) raised the priority of this task from to 90.
eroMoD (tostrong4you) updated the task description. (Show Details)
eroMoD (tostrong4you) edited a custom field.
Campbell Barton (campbellbarton) lowered the priority of this task from 90 to 30.Feb 8 2016, 2:27 AM

Quick test works OK here.
Please give details on what doesn't work.

I copy/paste:
mylayers = [False] * 20

then hit return

then I copy/paste:
mylayers[0] = True

then I hit return

then I copy/paste:
add_cube = bpy.ops.mesh.primitive_cube_add

then hit return

then I copy/paste:
for index in range(0, 5):
... add_cube(location=(index * 3, 0, 0), layers=mylayers)

then hit return

and this shows up in red:

File "<blender_console>", line 2
  ...     add_cube(location=(index * 3, 0, 0), layers=mylayers)
    ^

IndentationError: expected an indented block

This is showing what the python prompt will look like, you're not meant to type it in.
Yet its not really needed, and a bit confusing, removed rBM1311.