question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

json.decoder.JSONDecodeError: Expecting value

See original GitHub issue

Hi @agentphantom ,

This is me again, sorry. I have another issue with the script. I’m trying to download the submissions from r/goodanimemes from the last 2 weeks.

But after some time I get this error message : Traceback (most recent call last): File "subreddit_submissions_alt.py", line 115, in <module> init() File "subreddit_submissions_alt.py", line 40, in init download_submissions(subreddit=subreddit) File "subreddit_submissions_alt.py", line 110, in download_submissions download_submissions(subreddit, latest_timestamp) File "subreddit_submissions_alt.py", line 110, in download_submissions download_submissions(subreddit, latest_timestamp) File "subreddit_submissions_alt.py", line 110, in download_submissions download_submissions(subreddit, latest_timestamp) [Previous line repeated 80 more times] File "subreddit_submissions_alt.py", line 72, in download_submissions json_data = response.json() File "C:\Python38\lib\site-packages\requests\models.py", line 898, in json return complexjson.loads(self.text, **kwargs) File "C:\Python38\lib\json\__init__.py", line 357, in loads return _default_decoder.decode(s) File "C:\Python38\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Python38\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)

So I tried to launch the script again and I get the same error message but this line [Previous line repeated 80 more times] changed to [Previous line repeated 24 more times] (it’s a random number everytime).

I’m no JS programmer but my wild guess is that at some point, response.json() does not receive the right parameters, program does not know how to handle it and it causes it to stop.

Do you have any fix for this ? Thank you !

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
teisseire117commented, Sep 13, 2020

The clouds can use any custom font but I didn’t include it in the repo as I don’t have the license. You have 2 opions:

  1. Provide any font and rename it to ‘sofiapro-light.otf’ and put it in the assets folder.
  2. Remove the parameter ‘font_path’ from both functions.

It works !!! Yes 😄 Also, I noticed generate_most_common_entities_word_cloud does not remove lines containing links so the datagram is filled with “https” “reddit” “jpg” etc. I found we can remove those text with : df = df[~df["text"].str.contains('http')] in case you’re interested 😃

Thank you for your patience and help ❤️ I wish you a good day !

0reactions
agentphantomcommented, Sep 13, 2020

The clouds can use any custom font but I didn’t include it in the repo as I don’t have the license. You have 2 opions:

  1. Provide any font and rename it to ‘sofiapro-light.otf’ and put it in the assets folder.
  2. Remove the parameter ‘font_path’ from both functions.
Read more comments on GitHub >

github_iconTop Results From Across the Web

JSONDecodeError: Expecting value: line 1 column 1 (char 0)
JSONDecodeError: Expecting value: line 1 column 1 (char 0) also happens when the first line in the json response is invalid. Example response ......
Read more >
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The Python json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) occurs when we try to parse something that is not valid JSON...
Read more >
Expecting Value: Line 1 column 1 (char 0) - Python Pool
JSONDecodeError means there is an incorrect JSON format being followed. For instance, the JSON data may be missing a curly bracket, have a...
Read more >
json.decoder.jsondecodeerror: expecting value: line 1 column ...
The JSON decoder expecting a value at the very first character of the very first line simply means that it is finding no...
Read more >
The json.load, JSONDecodeError: Expecting value: line 1 ...
You are trying to jsondecodeerror: expecting value: line 1 column 1 (char 0) directly then you ... BZ2File(full_filename).read().decode()).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found