gpt4 book ai didi

python - 使用 Mega 模块命令的预期字符串或缓冲区

转载 作者:行者123 更新时间:2023-12-03 08:54:44 32 4
gpt4 key购买 nike

执行 mega.login(email,password) 时出现以下错误

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "mega\mega.py", line 26, in login
instance.login_user(email, password)
File "mega\mega.py", line 32, in login_user
resp = self.api_request({'a': 'us', 'user': email, 'uh': uh})
File "mega\mega.py", line 87, in api_request
json_resp = json.loads(req.text)
File "C:\Python27\lib\json\__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "C:\Python27\lib\json\decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: expected string or buffer

请注意文件 req.text 不是我的,但我认为它与 mega 或 json 模块有关。另外,我从 GitHub https://github.com/richardasaurus/mega.py 上抓取了巨型模块。
谢谢你帮助我:-)

最佳答案

当值不是字符串时出现此错误,例如None .

在您的情况下,这意味着 emailpasswordNone .

例子:

>>> import json
>>> json.loads(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 365, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: expected string or buffer

关于python - 使用 Mega 模块命令的预期字符串或缓冲区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29710848/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com