请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

拿着老师的源码,debug save_cookies_to_file(driver)时候一直报错:JSONDecodeError

代码是老师的源码(路径修改为本地自己的了)具体报错:
C:\Python37\python.exe “C:\Program Files\JetBrains\PyCharm Community Edition 2018.1.4\helpers\pydev\pydevd.py” --multiproc --qt-support=auto --client 127.0.0.1 --port 51804 --file D:/project/project/part_two/jingdong2.py
Connected to pydev debugger (build 181.5087.37)
pydev debugger: process 5284 is connecting

Traceback (most recent call last):
File “C:\Program Files\JetBrains\PyCharm Community Edition 2018.1.4\helpers\pydev\pydevd.py”, line 1664, in
main()
File “C:\Program Files\JetBrains\PyCharm Community Edition 2018.1.4\helpers\pydev\pydevd.py”, line 1658, in main
globals = debugger.run(setup[‘file’], None, None, is_module)
File “C:\Program Files\JetBrains\PyCharm Community Edition 2018.1.4\helpers\pydev\pydevd.py”, line 1068, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File “C:\Program Files\JetBrains\PyCharm Community Edition 2018.1.4\helpers\pydev_pydev_imps_pydev_execfile.py”, line 18, in execfile
exec(compile(contents+"\n", file, ‘exec’), glob, loc)
File “D:/project/project/part_two/jingdong2.py”, line 161, in
login_status = check_cookies()
File “D:/project/project/part_two/jingdong2.py”, line 45, in check_cookies
driver = save_cookies_to_driver()
File “D:/project/project/part_two/jingdong2.py”, line 61, in save_cookies_to_driver
jd_cookies_dict = json.loads(jd_cookies_str)
File “C:\Python37\lib\json_init_.py”, line 348, in loads
return _default_decoder.decode(s)
File “C:\Python37\lib\json\decoder.py”, line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “C:\Python37\lib\json\decoder.py”, line 355, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

正在回答 回答被采纳积分+3

1回答

大周 2020-05-06 00:32:28

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)这句话比较关键,json解析有问题,你看看数据。 

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信