简体   繁体   中英

Python file that has always worked suddenly getting json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

This file has worked every time I've run it every day until today. Based on the error, here's what I think is the relevant code:

LastFM_artistMBID = MusicBrainz_artistMBID
get_artist_info_from_LastFM = lastFM.makeGetArtistInfoFromLastFM_URL(LastFM_artistMBID)
artist_info_from_LastFM = requests.get(get_artist_info_from_LastFM)
artistData = json.loads(artist_info_from_LastFM.text)

That last line is what the error(s) at the bottom seem to hate.

The MusicBrainz_artistMBID variable in the first line above is an item from the mbid_array2 list below. All of the above code is part of the get_artists_data function below. If you need more code, I can edit this answer.

for mbid in artistsData.mbid_array2:
    get_artists_data(mbid)

Errors (including the first line from a print command while debugging):

<Response [200]>
Traceback (most recent call last):
  File "getArtistDataCron.py", line 216, in <module>
    get_artists_data(mbid)
  File "getArtistDataCron.py", line 54, in get_artists_data
    artistData = json.loads(artist_info_from_LastFM.text)
  File "/home/bombybomb/anaconda3/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/home/bombybomb/anaconda3/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/bombybomb/anaconda3/lib/python3.6/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)

I've tried several solutions and suggestions I've found from Googling but nothing seems to fix it. This file worked fine every time until today.

Expecting value: line 1 column 1 (char 0) means that the given value is entirely empty. Chances are the server is responding with no content at all due to a problem on the server end. You would just have to wait until the issues on the server are resolved if you have no access to fixing the server issues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM