Bug #1651

xpath bug

Added by Jean-Philippe Dutreve over 2 years ago. Updated about 2 years ago.

Status:Resolved Start:2014-11-03
Priority:High Due date:
Assigned to:- % Done:

100%

Category:- Spent time: -
Target version:1.1
Module: Branch:

Description

I've got this error in several bank modules :

File "/root/.local/share/weboob/modules/1.1/ing/module.py", line 68, in iter_accounts
return self.browser.get_accounts_list()
File "/usr/lib/python2.6/site-packages/weboob-1.1-py2.6.egg/weboob/browser/browsers.py", line 687, in inner
browser.do_login()
File "/root/.local/share/weboob/modules/1.1/ing/browser.py", line 77, in do_login
self.page.login(self.password)
File "/root/.local/share/weboob/modules/1.1/ing/pages/login.py", line 109, in login
vk = INGVirtKeyboard(self)
File "/root/.local/share/weboob/modules/1.1/ing/pages/login.py", line 55, in init
img = page.doc.xpath("//div[has-class('clavier')]/img")
File "lxml.etree.pyx", line 1833, in lxml.etree._ElementTree.xpath (src/lxml/lxml.etree.c:41739)
File "xpath.pxi", line 343, in lxml.etree.XPathDocumentEvaluator.__call__ (src/lxml/lxml.etree.c:103637)
File "xpath.pxi", line 208, in lxml.etree._XPathEvaluatorBase._handle_result (src/lxml/lxml.etree.c:102462)
File "lxml.etree.pyx", line 230, in lxml.etree._ExceptionContext._raise_if_stored (src/lxml/lxml.etree.c:6799)
File "extensions.pxi", line 688, in lxml.etree._extension_function_call (src/lxml/lxml.etree.c:100245)
File "/usr/lib/python2.6/site-packages/weboob-1.1-py2.6.egg/weboob/browser/pages.py", line 500, in has_class
expressions = ' and '.join(["contains(concat(' ', normalize-space(@class), ' '), ' {} ')".format(c) for c in classes])
ValueError: zero length field name in format

or for creditcooperatif :

File "/usr/lib/python2.6/site-packages/weboob-1.1-py2.6.egg/weboob/browser/elements.py", line 142, in iter
for el in self.find_elements():
File "/usr/lib/python2.6/site-packages/weboob-1.1-py2.6.egg/weboob/browser/elements.py", line 133, in find_elements
for el in self.el.xpath(self.item_xpath):
File "lxml.etree.pyx", line 1833, in lxml.etree._ElementTree.xpath (src/lxml/lxml.etree.c:41739)
File "xpath.pxi", line 343, in lxml.etree.XPathDocumentEvaluator.__call__ (src/lxml/lxml.etree.c:103637)
File "xpath.pxi", line 208, in lxml.etree._XPathEvaluatorBase._handle_result (src/lxml/lxml.etree.c:102462)
File "lxml.etree.pyx", line 230, in lxml.etree._ExceptionContext._raise_if_stored (src/lxml/lxml.etree.c:6799)
File "extensions.pxi", line 688, in lxml.etree._extension_function_call (src/lxml/lxml.etree.c:100245)
File "/usr/lib/python2.6/site-packages/weboob-1.1-py2.6.egg/weboob/browser/pages.py", line 500, in has_class
expressions = ' and '.join(["contains(concat(' ', normalize-space(@class), ' '), ' {} ')".format(c) for c in classes])
ValueError: zero length field name in format

I'm using lxml 2.2.3.

Any ideas ?

Associated revisions

Revision 656440b5eed6634b87fdc446b4153494d30cf1d2
Added by Florent Fourcot over 2 years ago

Add argument for compatibility with python 2.6

Closes: #1651

History

Updated by Jean-Philippe Dutreve over 2 years ago

Pyhon2.6 requires you to put a positional argument in the {}.

Fixe: /usr/lib/python2.6/site-packages/weboob-1.1-py2.6.egg/weboob/browser/pages.py", line 500

expressions = ' and '.join(["contains(concat(' ', normalize-space(@class), ' '), ' {0} ')".format(c) for c in classes])
xpath = 'self::*[@class and {0}]'.format(expressions)

Updated by Florent Fourcot over 2 years ago

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

Updated by Romain Bignon about 2 years ago

  • Target version set to 1.1

Also available in: Atom PDF