pallets-eco / flask-openid

Flask-OpenID adds openid support to flask applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError: Unicode strings with encoding declaration are not supported.

qherreros opened this issue · comments

I have this error with python3 :

ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.

It happens when I use try_login('...').

Please provide the entire traceback.

Traceback (most recent call last)

File "/usr/lib/python3/dist-packages/flask/app.py", line 1836, in __call__

return self.wsgi_app(environ, start_response)

File "/usr/lib/python3/dist-packages/flask/app.py", line 1820, in wsgi_app

response = self.make_response(self.handle_exception(e))

File "/usr/lib/python3/dist-packages/flask/app.py", line 1403, in handle_exception

reraise(exc_type, exc_value, tb)

File "/usr/lib/python3/dist-packages/flask/_compat.py", line 33, in reraise

raise value

File "/usr/lib/python3/dist-packages/flask/app.py", line 1817, in wsgi_app

response = self.full_dispatch_request()

File "/usr/lib/python3/dist-packages/flask/app.py", line 1477, in full_dispatch_request

rv = self.handle_user_exception(e)

File "/usr/lib/python3/dist-packages/flask/app.py", line 1381, in handle_user_exception

reraise(exc_type, exc_value, tb)

File "/usr/lib/python3/dist-packages/flask/_compat.py", line 33, in reraise

raise value

File "/usr/lib/python3/dist-packages/flask/app.py", line 1475, in full_dispatch_request

rv = self.dispatch_request()

File "/usr/lib/python3/dist-packages/flask/app.py", line 1461, in dispatch_request

return self.view_functions[rule.endpoint](**req.view_args)

File "/usr/lib/python3/dist-packages/flask_openid.py", line 495, in decorated

return f(*args, **kwargs)

File "/home/quentin/Documents/Repository/dota-website/app/views.py", line 31, in login

return oid.try_login('http://steamcommunity.com/openid')

File "/usr/lib/python3/dist-packages/flask_openid.py", line 547, in try_login

auth_request = consumer.begin(identity_url)

File "/usr/lib/python3/dist-packages/openid/consumer/consumer.py", line 343, in begin

service = disco.getNextService(self._discover)

File "/usr/lib/python3/dist-packages/openid/yadis/manager.py", line 105, in getNextService

yadis_url, services = discover(self.url)

File "/usr/lib/python3/dist-packages/openid/consumer/discover.py", line 471, in discover

return discoverURI(identifier)

File "/usr/lib/python3/dist-packages/openid/consumer/discover.py", line 463, in discoverURI

claimed_id, openid_services = discoverYadis(uri)

File "/usr/lib/python3/dist-packages/openid/consumer/discover.py", line 395, in discoverYadis

openid_services = OpenIDServiceEndpoint.fromXRDS(yadis_url, body)

File "/usr/lib/python3/dist-packages/openid/consumer/discover.py", line 195, in fromXRDS

return extractServices(uri, xrds, cls)

File "/usr/lib/python3/dist-packages/openid/yadis/services.py", line 47, in applyFilter

et = parseXRDS(xrd_data)

File "/usr/lib/python3/dist-packages/openid/yadis/etxrd.py", line 69, in parseXRDS

element = ElementTree.XML(text)

File "lxml.etree.pyx", line 3083, in lxml.etree.XML (src/lxml/lxml.etree.c:70338)

File "parser.pxi", line 1823, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:106368)

ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.

I just have to run the same code through python 2.7 to get rid of this issue. But it doesn't work at all for python 3.4

That sounds like a bug in the underlying openid library that flask-openid uses. You should probably report a bug against this.

The support of Python 3 in flask-openid is mostly community provided unfortunately.

Ok thanks. The name of the library is python3-openid right?