The weboob core is compatible with both Python 2 and Python 3. Weboob commands can thus be run with Python 3. The limitation is that some modules are not compatible with Python 3 yet, so they must be ported.
A few tips for porting them to Python 2/Python 3 compatibility:
- Browser 1 (
weboob.deprecated.*
) is not compatible with Python 3, use Browser 2 (weboob.browser.*
) - It's strongly recommended to use
from __future__ import unicode_literals, division, absolute_import
- Don't import
urllib
,urlparse
, useweboob.tools.compat
which contains the functions you want - For dicts, don't use
iteritems
,itervalues
butitems
,values
- Be careful with bytes/unicode confusion. You can import
basestring
orunicode
aliases fromweboob.tools.compat
To test porting:
-
if your weboob installation isn't in Python 3 by default, run
python3 $(which boobank) -b your_module
, replaceboobank
by the weboob command you want to use andyour_module
by the module to port -
run all sub-commands you would normally use with the module
-
declare the module name in
tools/py3-compatible.modules
(andgit-add
this modification to the porting commit) -
run
tools/pyflakes.sh -3