[Sugar-devel] ObjectChooser() Issue?

Art Hunkins abhunkin at uncg.edu
Mon Nov 8 13:01:02 EST 2010


At Sasha's suggestion, I've arrived at the following code to send the 
filepath of a soundfile to Csound via its reference in the Journal. The 
filename (self.filename[0]) is being correctly passed:

 def choose1(self, widget):
  chooser =  ObjectChooser(parent=self, what_filter=mime.GENERIC_TYPE_AUDIO)
  result = chooser.run()
  if result == gtk.RESPONSE_ACCEPT:
    jobject = chooser.get_selected_object()
    if jobject and jobject.file_path:
      self.filename[0] = str(jobject.file_path)
#      open(jobject.file_path).read()
#      open(self.filename[0]).read()
  else:
    self.filename[0] = "0"

The problem is that the file cannot be opened by Csound - either via the 
above function as it stands, or by the addition of either line that is 
commented out.

I receive this error message (from Csound):
diskinfo can't open 
/home/olpc/.sugar/default/data/f70f03b1-fe40-44e6-9d75-5ef274cf0ad2.wav
The filepath and name are correct, and the file can be played fine with 
either Browse or Jukebox.

What must I do to make the referenced soundfile readable?

Art Hunkins



More information about the Sugar-devel mailing list