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

Anish Mangal anish at activitycentral.com
Tue Apr 24 10:00:09 EDT 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue 24 Apr 2012 07:21:27 PM IST, Gonzalo Odiard wrote:
>     >
>     >  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.

True, but you might be adding more code in the future here, and would
be a good practice to catch only the problems you except will happen.
Other "interesting" problems will get suppressed with a generic except
statement. But anyway, that's erikos's call :-)

> I think is better see the error in the log, and a exception hide the
> problem.

Sorry, didn't understand. Was this about
s/logging.warning/logging.exception?

> 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

- --
Anish
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPlrHpAAoJEBoxUdDHDZVpSlkH/jqkTh+p+IP+3YX/SClINET9
g7wHXhkDPHRr50Xl07uJOCzrQxwIMnFDhyO5Sc7deS2u7XmUPHA/Rpqsg4Op7DYn
TklFML6sfgi1vCBP5kIctPfFmE1LPAFAMC3LPnpoRNgnxOaONvKYlKVQil7Ip8Ij
HvjrCjfLVhiVq/uvk6JUXXwwfxXjpr1W6Cy/3lBPGPLPpRQwnKnGShyLiVncK/C6
39aAg/qN9kZzGwzGMew7DsIDlh8AbJlTzae1Lgn1FqfERK2Va9KU0yKAzwR1Y71Q
ATtrr732eUVNTUJM4FycOY1/RMWqe2r+t64uKgjgzZc59hvqEB2eN8kpr3vZIkQ=
=8xmz
-----END PGP SIGNATURE-----



More information about the Sugar-devel mailing list