tianzhengs/Beijing_Daxuexi_Simple

Json解析报错

Opened this issue · 4 comments

本周开始study.py中的haveLearned = bjySession.get(learnedInfo).json()运行报错,看起来像Json Decoder的问题,报错信息如下:

账号数量:2
--User 1--
登录成功
Traceback (most recent call last):
  File "C:\Users\PathfinderZ\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\PathfinderZ\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\PathfinderZ\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\PathfinderZ\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 2)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\01.Code\Beijing_Daxuexi_Simple-main\main.py", line 70, in <module>
    if study(username, password, ua):
  File "D:\01.Code\Beijing_Daxuexi_Simple-main\study.py", line 62, in study
    haveLearned = bjySession.get(learnedInfo).json()
  File "C:\Users\PathfinderZ\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 2 column 1 (char 2)

我也遇到了同样问题

zzy99 commented

是不是因为假期大学习停止了

暂时没有大学习了,开心吧

是否应该加一个报错提示?完善下