[weboob] RFC: Unicode encoding error

Guilhem Bonnefille guilhem.bonnefille at gmail.com
Sun May 11 23:07:42 CEST 2014


I'm still working on the integration of videoob in totem (and other
grilo compatible applications). Now, I need to retrieve list of
backends. I identified the command "videoob backends list-modules".

But, when using it inside my plugin, I encounter a "bug". I can
reproduce outside my plugin with the following command :

videoob backends list-modules | cat
Traceback (most recent call last):
Modules list:
[ ] arretsurimages    arretsurimages website
[X] arte              Arte French and German TV
[ ] canalplus         Canal Plus French TV
[ ] cappedtv          Capped.tv demoscene website
[ ] dailymotion       Dailymotion video streaming website
[ ] europarl          Europarl parliamentary video streaming website
  File "/usr/bin/videoob", line 27, in <module>
  File "/usr/lib/python2.7/dist-packages/weboob/tools/application/console.py",
line 201, in run
    super(ConsoleApplication, klass).run(args)
  File "/usr/lib/python2.7/dist-packages/weboob/tools/application/base.py",
line 431, in run
  File "/usr/lib/python2.7/dist-packages/weboob/applications/videoob/videoob.py",
line 76, in main
    return ReplApplication.main(self, argv)
  File "/usr/lib/python2.7/dist-packages/weboob/tools/application/repl.py",
line 311, in main
    ret = self.onecmd(cmd)
  File "/usr/lib/python2.7/dist-packages/weboob/tools/application/repl.py",
line 410, in onecmd
    return super(ReplApplication, self).onecmd(line)
  File "/usr/lib/python2.7/cmd.py", line 221, in onecmd
    return func(arg)
  File "/usr/lib/python2.7/dist-packages/weboob/tools/application/repl.py",
line 728, in do_backends
    print '[%s] %s%-15s%s   %s' % (loaded, self.BOLD, name, self.NC,
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in
position 32: ordinal not in range(128)

This can be "solved" by replacing this line with:
                print '[%s] %s%-15s%s   %s' % (loaded, self.BOLD,
name, self.NC, info.description.encode('utf-8'))

But I'm not sure it is the right things to do.

Furthermore, I noticed the "-f json" have no impact on this output. Is
it possible to improve this subcommand to support json output?

But most of all, this output is quite limited. Is there a way to
discover the effective capabilities of each backend? It seems that
most of them support the "Collection" cap, but I think that some of
them don't support the search. For example, when searching with the
arte backend, videoob return immediatly. Knowing detailed capabilities
can help to adapt the GUI.

Best regards,
-=- JID: guyou at im.apinc.org MSN: guilhem_bonnefille at hotmail.com
-=- mailto:guilhem.bonnefille at gmail.com
-=- http://nathguil.free.fr/

More information about the weboob mailing list