Page MenuHome

Python/RNA: Cannot use Step Indice for Slicing
Confirmed, LowPublicTO DO


System Information
Operating system: Darwin-17.7.0-x86_64-i386-64bit 64 Bits
Graphics card: AMD Radeon Pro 580 OpenGL Engine ATI Technologies Inc. 4.1 ATI-1.68.24

Blender Version
Broken: version: 2.82 (sub 7), branch: master, commit date: 2020-02-12 16:20, hash: rB77d23b0bd76f
Worked: (optional)

Short description of error
Cannot slice with step on image pixel data, must put into new array first
Error in System Console:

TypeError: slice indices must be integers or None or have an __index__ method
Error: Python script failed, check the message in the system console

Exact steps for others to reproduce the error
Startup file, make and run the following script

import bpy

orig =['any_image_file.jpg'].pixels
this_works = orig[0:6]
this_works = this_works[::3]
raises_exception = orig[0:6:3]

Related Objects

Event Timeline

Campbell Barton (campbellbarton) renamed this task from Cannot use Step Indice for Slicing to Python/RNA: Cannot use Step Indice for Slicing.Sat, Feb 15, 3:45 AM
Campbell Barton (campbellbarton) changed the task status from Needs Triage to Confirmed.
Campbell Barton (campbellbarton) triaged this task as Low priority.
Campbell Barton (campbellbarton) changed the subtype of this task from "Report" to "To Do".