[Sugar-devel] ObjectChooser() Issue?

Gonzalo Odiard gonzalo at laptop.org
Tue Nov 9 13:10:56 EST 2010


On Tue, Nov 9, 2010 at 3:04 PM, Aleksey Lim <alsroot at member.fsf.org> wrote:

> 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).
>
>
Why is destroyed jobject ?
Only curiosity, I have read the mail and don't understand what is the
problem with the code.

Gonzalo



> >     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
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20101109/736afef1/attachment-0001.html>


More information about the Sugar-devel mailing list