json格式不对引起的报错

报JSONDecondeError这种类型的错误的时候就要检查下json格式是否是正确的了,这里提供一个http://www.bejson.com/

Traceback (most recent call last):
File "D:/python开发代码/Python之路/作业/New_Credit_Shopping/core/login.py", line 27, in <module>
menu.menushow(current_user) #调用显示菜单
File "D:\python开发代码\Python之路\作业\New_Credit_Shopping\modules\menu.py", line 34, in menushow
shopping.PayShopping(current_user)
File "D:\python开发代码\Python之路\作业\New_Credit_Shopping\modules\shopping.py", line 78, in PayShopping
Credit_info = json.loads(credit_file.read())
File "C:\python3.5\lib\json\__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "C:\python3.5\lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\python3.5\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

posted @ 2016-11-11 14:50  梦轻尘  阅读(10070)  评论(0编辑  收藏  举报