Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raise JSONDecodeError("Expecting value", s, err.value) from None #1

Open
chunshengding opened this issue Mar 20, 2024 · 0 comments
Open

Comments

@chunshengding
Copy link

你好 麻烦想请教一下如下问题
1、报错提示 raise JSONDecodeError("Expecting value", s, err.value) from None
File "D:\工作\cangqiong-scratch-master\main.py", line 29, in get
return json.loads(res.content.decode())
File "C:\Users\ChunshengDing\AppData\Local\Programs\Python\Python39\lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\ChunshengDing\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\ChunshengDing\AppData\Local\Programs\Python\Python39\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)

2、报错代码位置
def raw_decode(self, s, idx=0):
"""Decode a JSON document from s (a str beginning with
a JSON document) and return a 2-tuple of the Python
representation and the index in s where the document ended.

    This can be used to decode a JSON document from a string that may
    have extraneous data at the end.

    """
    try:
        obj, end = self.scan_once(s, idx)
    except StopIteration as err:
        raise JSONDecodeError("Expecting value", s, err.value) from None # 在这里报错
    return obj, end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant