0

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!

zeffii
  • 39,634
  • 9
  • 103
  • 186
Chickenator
  • 1,803
  • 5
  • 22
  • 33
  • 1
    try changing "C:\Users\Stephen\Music\Arcade Blaster - Reboot.wav" to "C:/Users/Stephen/Music/Arcade Blaster - Reboot.wav" – Chebhou May 23 '15 at 10:18
  • 1
    what happens if you stick an r infront of your filepath, it will escape the backslash and make them double-backslashes. filepath=r"C:\...." – zeffii May 23 '15 at 10:18
  • Sorry I just copied how windows said the filepath was :P Thanks for the help! – Chickenator May 23 '15 at 10:20
  • @Chickenator you should not delete the question , post an answer for future reference – Chebhou May 23 '15 at 10:53
  • @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. – Chickenator May 23 '15 at 10:55
  • @Chickenator the other one not this – Chebhou May 23 '15 at 11:00
  • @Chebhou oh right okay. I thought it was stupid of me that I didn't look around enough for the answer so I just closed the question. – Chickenator May 23 '15 at 11:02

1 Answers1

2

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

zeffii
  • 39,634
  • 9
  • 103
  • 186