Kodi Community Forum

Full Version: Unknown encoding: idna ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi python guys..

i need help with the following script! on the pc it works fine, but if i use the script on xbmc it won't work ? any idea?

here is the test script! workinf fine on pc!
Quote:import httplib, urllib, base64


ip = '192.168.0.110'
user = 'root'
password = 'blablabla'

def gethttprequest(request,portx, put01): #gethttprequest(requeststring, port':80', setuserpw 0:1 )
conn = httplib.httpconnection(ip+portx)
authhead = "basic %s " % base64.encodestring("%s:%s"%(user, password))

if put01 == '1':
conn.putrequest("get", request)
conn.putheader("authorization", authhead)
conn.endheaders()
else:
conn.request("get", request)
r = conn.getresponse()
print r.status, r.reason, r.msg
data = r.read()
conn.close()
return data

def test():
testx = gethttprequest('/version','','1')
print testx
test()

but on xbmc i get the following error!
Quote:31-07-2004 17:53:00 traceback (most recent call last):
31-07-2004 17:53:00 file "q:\scripts\dreambox-tv\get.py", line 27, in ?
31-07-2004 17:53:00
31-07-2004 17:53:00 test()
31-07-2004 17:53:00
31-07-2004 17:53:00 file "q:\scripts\dreambox-tv\get.py", line 25, in test
31-07-2004 17:53:00
31-07-2004 17:53:00 testx = gethttprequest('/version','','1')
31-07-2004 17:53:00 file "q:\scripts\dreambox-tv\get.py", line 13, in gethttprequest
31-07-2004 17:53:00
31-07-2004 17:53:00 conn.putrequest("get", request)
31-07-2004 17:53:00 file "q:\python\lib\httplib.py", line 667, in putrequest
31-07-2004 17:53:00
31-07-2004 17:53:00 self.putheader('host', self.host.encode("idna"))
31-07-2004 17:53:00 lookuperror
31-07-2004 17:53:00 :
31-07-2004 17:53:00 unknown encoding: idna
31-07-2004 17:53:00
hi, i came across your post from google, because i have a similar problem.

i've created a python script that uses httplib to screenscrape a page. it works from the script, but when i compile it using py2exe, it does not work, and i get a similar error:

traceback (most recent call last):
file "startup.pyc", line 456, in onconfigsubmit
file "httplib.pyc", line 718, in request
file "httplib.pyc", line 733, in _send_request
file "httplib.pyc", line 669, in putrequest
lookuperror: unknown encoding: idna


if i figure out a solution, i'll let you know.

-pat
ok, i figured out my problem. py2exe doesn't automatically bundled the characterset codecs, i have to add the option: "setup.py py2exe --packages encodings"

it appears that idna support was added in python 2.3, so perhaps your xmbc is an older version?

-pat
this is a known problem to me.
problem is that for idna encoding you need the unicode character set. this can be added to xbmc but it takes a lot of memory (that's why i left it away).
i'm still working on it so you can expect an update for it soon
yay! darkie's back!
should be fixed now in cvs
@darkie

same problem, is not fixed!

unicodedata.pyd is includet!

regards
geminiserver