Syntax error help

I have a script which contains a syntax error on line 23 but I cannot find it. Can someone help? I am very new to coding, and I wrote this script from a video tutorial which seemed to work for the person that made for the tutorial. I have changed the script very slightly to suit me, I do not think this is why it is not working, but it is a possibility.

This is the tutorial:

This is the script i have created from the tutorial:

import bpy
rows=80
columns=1
r=0
c=0
for i in range(0,rowscolumns):
if c==columns:
r+=1
c=0
bpy.ops.mesh.primitive_cube_add(location=(r
2,c2,1))
bpy.context.scene.cursor_location=bpy.context.active_object.location
bpy.context.scene.cursor_location.z-=1
bpy.ops.object.origin_set(type=‘ORIGIN_CURSOR’)
bpy.context.active_object.scale.x=0.1
bpy.context.active_object.scale.y=0.1
bpy.context.active_object.scale.z=10
bpy.ops.object.transform_apply(scale=True)
bpy.ops.anim,keyframe_insert_menu(type=‘Scaling’)
bpy.context.active_object-animation_data.action.fcurves[0].lock=True
bpy.context.active_object-animation_data.action.fcurves[1].lock=True
bpy.context.area.type=‘GRAPH_EDITOR’
step = 20000/(rows
columns)
bpy.ops.graph.sound_bake(filepath=“C:\Users\Max\Music\My Tracks\1.wav”,low=istep.high=istep+step)
bpy.context.active_object-animation_data.action.fcurves[2].lock=True
c+=1

I thank you in advance for any help you can provide.

This line

bpy.context.scene.cursor_location=bpy.context.acti ve_object.location

you have a space in active take that space out and try again.

Oh yeah i see it, but that’s not the problem in the project file, I must have acciadentally added it when I copied it to here.
In Blender when i try to run the script it says there’s a syntax error on line 23.

Ah okay. I do think I remember seeing something about the audio visualizer not working somewhere here on the forums can’t quite remember where though.

I wonder if it’s the space in the folder location My Music Python doesn’t like spaces I think to make the space it’s %20 but don’t quote me trying to find documentation for that.

edit

%20 isn’t a code thing it’s a web thing so don’t do that. I haven’t gone through that tutorial yet probably should.

I have tried the speaker tools addon, but i found it to be a little unclear on what to do on each step, which is why i am now trying the method in the tutorial about writing the script from scratch. I just don’t understand how it worked for the person that made the tutorial and not me. The only reason i can think of it not working is that i am using a newer version of blender than in the tutorial, or that i have substituted in my own values for the rows and columns. have you watched the tutorial i linked to? if not i would highly advise it as i tried to follow it as closely as i could. you may notice that in my coding the last part of the tutorial is left out, because i want to have the cubes in a line rather than a grid.

Max1

Really not interested in looking at the tutorial mate.

Wrap your code in tags. Then its simple cut and paste to text, run and test.

Just looking at your code some simple mistakes shine out.

The single escape character "" in the filepath
the hyphen “-” in active_object-animation_data
the comma “,” in bpy.ops.anim,keyframe_insert_menu(type=‘Scaling’)

ok i’ll try these