我在另一个使用它的文件中得到的错误代码是:
Traceback (most recent call last):
File "C:\Anaconda\lib\site-packages\pyahoolib-0.2-py2.7.egg\yahoo\session.py", line 107, in listener
t.send_pk(consts.SERVICE_AUTHRESP, auth.hash(t.login_id, t.passwd, p[94]))
File "C:\Anaconda\lib\site-packages\pyahoolib-0.2-py2.7.egg\yahoo\auth.py", line 73, in hash
hs = md5.new(mkeystr+"".join(map(chr,[x,x>>8,y]))).digest()
ValueError: chr() arg not in range(256)
更新:@merlin2011:这让我很困惑。代码是 hs = md5.new(mkeystr+"".join(map(chr,[x,x>>8,y]))).digest()
chr 后面有逗号。我认为这是来自 doc.python.org 的函数:chr(i)
Return a string of one character whose ASCII code is the integer i. For example, chr(97) returns the string 'a'. This is the inverse of ord(). The argument must be in the range [0..255], inclusive; ValueError will be raised if i is outside that range. See also unichr().
如果是这样, [x,x>>8,y] 是我还不认识的 map() 的可迭代对象吗?
另外,我不想更改任何代码,因为它是 pyahoolib-0.2 auth.py 文件的一部分。但是要让这一切正常工作,我不知道该怎么做。