[Sugar-devel] ObjectChooser() Issue?
Aleksey Lim
alsroot at member.fsf.org
Tue Nov 9 13:04:53 EST 2010
On Mon, Nov 08, 2010 at 01:01:02PM -0500, Art Hunkins wrote:
> 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()
After destroying "jobject" object, you will lose
/home/olpc/.sugar/default/data/f70f03b1-fe40-44e6-9d75-5ef274cf0ad2.wav
file, so either keep this object or move/hard-link file somethere
for later usage (but remove it after using).
> 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
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
--
Aleksey
More information about the Sugar-devel
mailing list