import bpy
import csv
import numpy as np
data_path = 'C:/Users/E/Desktop/example.csv'
ob = bpy.context.object
with open(data_path, 'r') as f:
reader = csv.reader(f, delimiter=',')
names = next(reader)
data = np.array(list(reader))
shapekeys = ob.data.shape_keys.key_blocks
for i in range(data.shape[0]):
if data[i][1] != '0':
for shape in shapekeys:
if shape.name in names:
index = names.index(shape.name)
shape.value=float(data[i][index])
shape.keyframe_insert("value", frame=i)
# The script does all the data mining to get the needed values.
# It allocates 3 values needed to utilize
# shape.name = bone name
# shape.value = location Y
# current frame = i
# I added these lines below but it doesn't work
pb = ob.pose.bones.get(shape.name)
if pb:
pb.location.y = shape.value
pb.keyframe_insert("location", i ) # y location
This script gives me an error "armature object has no attribute" So what is it that is needed to make this script allocate bone values locations Y?