[Sugar-devel] [PATCH] Handle missing gst-plugins-espeak gracefully - SL#3345

Gonzalo Odiard godiard at sugarlabs.org
Tue Apr 24 09:51:27 EDT 2012


>
> >
> >  def setup(tray):
> > -    tray.add_device(SpeechDeviceView())
> > +    try:
> > +        tray.add_device(SpeechDeviceView())
> > +    except:
> > +        logging.warning('Text to speech no available. Missing
> dependencies')
>
> Ideally we shouldn't be just catching generic exceptions like above but
> rather specific...
>
> except <SomeException>:
>
> Also, instead of logging.warning, maybe a logging.exception would be
> better?
>
>
In this case, any exception will mean the service is unavailable.
I think is better see the error in the log, and a exception hide the
problem.
Really, we have more important problems to solve....



> > diff --git a/extensions/globalkey/speech.py
> b/extensions/globalkey/speech.py
> > index 2879b69..e47c778 100644
> > --- a/extensions/globalkey/speech.py
> > +++ b/extensions/globalkey/speech.py
> > @@ -14,10 +14,9 @@
> >  # along with this program; if not, write to the Free Software
> >  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
>  USA
> >
> > -from jarabe.model import speech
> > -
> >  BOUND_KEYS = ['<alt><shift>s']
> >
> > +from jarabe.model import speech
> >
>
> Why the need to move this import below the const declaration? Its not
> that way in other extension modules.
>
>
My mistake :(

Gonzalo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120424/7c0a4432/attachment.html>


More information about the Sugar-devel mailing list