Bug #1673

UnicodeEncodeError: 'ascii' codec can't encode character u'\xf4' in position 26: ordinal not in range(128)

Added by Phil Ar about 3 years ago. Updated almost 3 years ago.

Status:Resolved Start:2014-11-19
Priority:High Due date:
Assigned to:Florent Fourcot % Done:

100%

Category:Applications / Console Spent time: -
Target version:1.1
Module: Branch:

Description

When I use bookank and list available backend, I have the following error

Configuration of backend creditdunord
-------------------------------------
      1) Banque Courtois (www.banque-courtois.fr)
      2) Banque Kolb (www.banque-kolb.fr)
Traceback (most recent call last):
  File "/home/pi/bin/boobank", line 5, in <module>
    pkg_resources.run_script('weboob==1.0', 'boobank')
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 499, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1235, in run_script
    execfile(script_filename, namespace, namespace)
  File "/home/pi/.local/lib/python2.7/site-packages/weboob-1.0-py2.7.egg/EGG-INFO/scripts/boobank", line 27, in <module>
    Boobank.run()
  File "/home/pi/.local/lib/python2.7/site-packages/weboob-1.0-py2.7.egg/weboob/tools/application/console.py", line 198, in run
    super(ConsoleApplication, klass).run(args)
  File "/home/pi/.local/lib/python2.7/site-packages/weboob-1.0-py2.7.egg/weboob/tools/application/base.py", line 464, in run
    sys.exit(app.main(args))
  File "/home/pi/.local/lib/python2.7/site-packages/weboob-1.0-py2.7.egg/weboob/tools/application/repl.py", line 333, in main
    self.cmdloop()
  File "/usr/lib/python2.7/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/home/pi/.local/lib/python2.7/site-packages/weboob-1.0-py2.7.egg/weboob/tools/application/repl.py", line 430, in onecmd
    return super(ReplApplication, self).onecmd(line)
  File "/usr/lib/python2.7/cmd.py", line 221, in onecmd
    return func(arg)
  File "/home/pi/.local/lib/python2.7/site-packages/weboob-1.0-py2.7.egg/weboob/tools/application/repl.py", line 724, in do_backends
    self.edit_backend(backend.name)
  File "/home/pi/.local/lib/python2.7/site-packages/weboob-1.0-py2.7.egg/weboob/tools/application/console.py", line 300, in edit_backend
    return self.add_backend(name, params, True)
  File "/home/pi/.local/lib/python2.7/site-packages/weboob-1.0-py2.7.egg/weboob/tools/application/console.py", line 337, in add_backend
    params[key] = self.ask(value, default=params[key] if (key in params) else value.default)
  File "/home/pi/.local/lib/python2.7/site-packages/weboob-1.0-py2.7.egg/weboob/tools/application/console.py", line 459, in ask
    print('     %s%2d)%s %s' % (self.BOLD, n + 1, self.NC, value))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf4' in position 26: ordinal not in range(128)

I have attached a patch that works in my environment

diff.txt (749 Bytes) Phil Ar, 11/19/2014 11:27 pm

Associated revisions

Revision 76da33368f2c157aedddaed33ee999485276244e
Added by Florent Fourcot almost 3 years ago

Encode properly output in console.py (fix #1673)

History

Updated by Nicolas V. almost 3 years ago

Hello, I have exactly the same problem, with the same application, no backend so far, I am trying to add one :

# boobank 
Warning: there is currently no configured backend for boobank
Do you want to configure backends? (Y/n): Y

Available modules:
1) [ ] alloresto         Allo Resto
2) [ ] amazonstorecard   Amazon Store Card
3) [ ] americanexpress   American Express
4) [ ] apivie            Apivie
5) [ ] axabanque         AXA Banque
6) [ ] banqueaccord      Banque Accord
7) [ ] banquepopulaire   Banque Populaire
8) [ ] barclays          Barclays
9) [ ] bnporc            BNP Paribas
10) [ ] boursorama        Boursorama
11) [ ] bp                La Banque Postale
12) [ ] bred              Bred
Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/boobank", line 27, in <module>
    Boobank.run()
  File "/usr/lib64/python2.7/site-packages/weboob/tools/application/console.py", line 198, in run
    super(ConsoleApplication, klass).run(args)
  File "/usr/lib64/python2.7/site-packages/weboob/tools/application/base.py", line 465, in run
    args = app.parse_args(args)
  File "/usr/lib64/python2.7/site-packages/weboob/tools/application/base.py", line 400, in parse_args
    self._handle_options()
  File "/usr/lib64/python2.7/site-packages/weboob/tools/application/repl.py", line 543, in _handle_options
    return super(ReplApplication, self)._handle_options()
  File "/usr/lib64/python2.7/site-packages/weboob/tools/application/console.py", line 182, in _handle_options
    self.load_default_backends()
  File "/usr/lib64/python2.7/site-packages/weboob/tools/application/console.py", line 193, in load_default_backends
    self.load_backends(self.CAPS)
  File "/usr/lib64/python2.7/site-packages/weboob/tools/application/repl.py", line 300, in load_backends
    return ConsoleApplication.load_backends(self, *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/weboob/tools/application/console.py", line 116, in load_backends
    self.check_loaded_backends()
  File "/usr/lib64/python2.7/site-packages/weboob/tools/application/console.py", line 126, in check_loaded_backends
    self.prompt_create_backends(default_config)
  File "/usr/lib64/python2.7/site-packages/weboob/tools/application/console.py", line 149, in prompt_create_backends
    self.BOLD, name, self.NC, info.description))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xc9' in position 51: ordinal not in range(128)

Infos : weboob-config --version
weboob-config v1.0 Copyright(C) 2010-2014 Christophe Benz, Romain Bignon

Installed on gentoo, and modules are up to date (2 backends installed for app boobill).

The diff patch given byt Phil didn't work for me as the line number is not the same, so far I had to add utf8 convertion for info.description

Updated by Florent Fourcot almost 3 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Updated by Florent Fourcot almost 3 years ago

  • Category changed from Application / boobank to Applications / Console
  • Assigned to changed from Romain Bignon to Florent Fourcot
  • Target version set to 1.1
  • Branch deleted (1.0 (stable))

Also available in: Atom PDF