Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unknown encoding: idna in Python Requests

I'm using Python Requests. All works great but today I get this strange error:

[...]
File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/requests/models.py", line 321, in full_url
    netloc = netloc.encode('idna').decode('utf-8')
LookupError: unknown encoding: idna

Any ideas what could be wrong? I'm using Python 2.7.2 from brew.

like image 732
user1130588 Avatar asked Feb 04 '12 21:02

user1130588


1 Answers

Try adding:

import encodings.idna

in various places to sift out other errors. I ran into this same problem working on a port of python to a new platform. We had only partial library support and unicodedata was missing which was causing imports of the idna module to fail. Once we ported unicodedata this error went away.

like image 91
duanev Avatar answered Sep 17 '22 19:09

duanev