0
$\begingroup$

I knows lots of people have been having problems with this tutorial but I haven't found anyone with the specific problem that I have (I've been looking for a while).

The script I have so far:

import bpy


rows = 5
columns = 5

r = 0
c = 0

for i in range(0, rows*columns):
    if c == columns:
        r += 1
        c = 0

    bpy.ops.mesh.primitive_cube_add(location = (r, c, 0))
    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.ops.object.transform_apply(scale=True)

    bpy.context.active_object.scale.x = 0.5
    bpy.context.active_object.scale.y = 0.5
    bpy.context.active_object.scale.z = 5

    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 = 100000/ (rows*columns)

    bpy.ops.graph.sound_bake(filepath="C:\Users\Stephen\Music\Arcade Blaster - Reboot.wav", low=i*step, high=i*step + step)

    bpy.context.active_object.animation_data.action.fcurves[2]. lock = true

    c += 1

The Error

I don't understand any of the error.

Can someone help solve/explain the error?

Thanks!

$\endgroup$
  • 1
    $\begingroup$ try changing "C:\Users\Stephen\Music\Arcade Blaster - Reboot.wav" to "C:/Users/Stephen/Music/Arcade Blaster - Reboot.wav" $\endgroup$ – Chebhou May 23 '15 at 10:18
  • 1
    $\begingroup$ what happens if you stick an r infront of your filepath, it will escape the backslash and make them double-backslashes. filepath=r"C:\...." $\endgroup$ – zeffii May 23 '15 at 10:18
  • $\begingroup$ Sorry I just copied how windows said the filepath was :P Thanks for the help! $\endgroup$ – Chickenator May 23 '15 at 10:20
  • $\begingroup$ @Chickenator you should not delete the question , post an answer for future reference $\endgroup$ – Chebhou May 23 '15 at 10:53
  • $\begingroup$ @Chebhou I haven't deleted it. Zeffni put up and answer and I'll keep the question up in case someone else encounters the same problem. $\endgroup$ – Chickenator May 23 '15 at 10:55
2
$\begingroup$

is it because your filepath is not a valid filepath?

Either use a prefix r to make the path raw, or use forward slashes. Backslashes have special meaning in programming languages like python. valid paths are

   # windows
   filepath = "C:\\some\\folder\\file.mp3"
   filepath = r"C:\some\folder\file.mp3"
   filepath = "C:/some/folder/file.mp3"

   # posix style (linux, osx)
   filepath = "/home/folder/file.mp3"

This bug is fixed as of today: this error will now return 'File not found', which is better: https://developer.blender.org/rB39b85e452faae543d10831e4fa66fdffbc22e0a1

| improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.