So, I am following a tutorial on CGCookie, and it is using Python code to create an audio visualizer in Blender. Now, I've always been a coding geek, but I don't actually know Python. I've taken a few shots at it but overall, I don't know Python, however, I can read and understand the code because I know basic programming concepts. Now, I'm following this tutorial as closely as I can (the tutorial does not provide code to copy and paste) and I am getting a syntax error. As far as I can tell, there is no syntax error. The line of code (specified by the error message) appears perfect. This line of code is supposed to set the 3D cursor to the active object's origin. Here's the catch: if I run that exact same line of code in the console, it executes just fine.
So here's the error message I get:
File "C:\Me\Blender\Blender Projects\audio visualisation.blend\AudioVisualizer", line 17
bpy.context.scene.cursor_location = bpy.context.active_object.location
^
SyntaxError: invalid syntax
location: <unknown location>:-1
It tells me to look in the console for error message, but the console doesn't output anything.
Here's my overall code:
Thanks!
EDIT: Alright. I've tried all the examples and all the procedures that have been suggested by you guys, but it keeps feeding me errors. According to the console, one of the problems it is spitting out is in C:\Program Files\Blender Foundation\Blender\2.74\scripts\modules\bpy\ops.py. This makes me think there is a bug in the API that is causing one of the many errors.
EDIT: Here are the error messages I get for my code. Original Code:
Error: File "C:\Gannon\Blender\Blender Projects\audio visualisation.blend\Audi
o Visualizer", line 35
bpy.ops.graph.sound_bake(filepath="C:\Gannon\Blender\Sounds\Music\Batty McFa
dden.mp3", low=i*step high=i*step+step
^
SyntaxError: invalid syntax
gandalf3's Code and zeffii's Code are essentially the same with alternative formatting which changes the line numbers where the error occurs.
Error: Unsupported audio format
Traceback (most recent call last):
File "C:\Gannon\Blender\Blender Projects\audio visualisation.blend\Audio Visua
lizer", line 42, in <module>
File "C:\Gannon\Blender\Blender Projects\audio visualisation.blend\Audio Visua
lizer", line 35, in spiral
File "C:\Program Files\Blender Foundation\Blender\2.74\scripts\modules\bpy\ops
.py", line 189, in __call__
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Error: Unsupported audio format


