[Sugar-devel] ObjectChooser() Issue?
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) 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
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 = str(jobject.file_path)
> # open(jobject.file_path).read()
> # open(self.filename).read()
> self.filename = "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
> 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
More information about the Sugar-devel