13

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.

Alex Riley
  • 169,130
  • 45
  • 262
  • 238
ierror
  • 513
  • 2
  • 6
  • 13

1 Answers1

26

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.

duanev
  • 936
  • 13
  • 17