I had this code working fine:
#----------------------------------------------
# Add to sequencer
#----------------------------------------------
try:
if self.add_sound == True:
# first look old copies
try:
context = bpy.context
scene = context.scene
seq = scene.sequence_editor
for strip in seq.sequences_all:
if strip.filepath == realpath:
seq.sequences.remove(strip)
break
except:
x = 1 # dummy
# Add strip
bpy.ops.sequencer.sound_strip_add(filepath=realpath
,frame_start=self.sound_frame)
self.report({'INFO'}, realpath + "successfully added to video sequencer")
except Exception as e:
print ("Unexpected error:" + str(sys.exc_info()))
self.report({'ERROR'}, "Unable to add to video sequencer")
But in Blender 2.72 I get an error of “context is incorrect” in bpy.ops.sequencer.sound_strip_add why?
Something change in API, I cannot see any in the API documentation.
Antonio