Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJulio Robles
382 Pointsjson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
When parsing a webpage this error happens once in a while and causes my script to fail and i have to restart from the beginning.
Traceback (most recent call last):
File "qcbook1.py", line 71, in <module>
data1 = json.loads(res1.text)
File "C:\Program Files\Python37\lib\json\__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Program Files\Python37\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Program Files\Python37\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)
if k == 1:
url_book = url_shelf+j['BookNSN']
print(url_book)
res1 = requests.get(url_book)
data1 = json.loads(res1.text)
#worksheet.write(row,col+20,' '.join([data1['bookInfo']['Year'],data1['bookInfo']['Month']]))
worksheet.write(row,col+22,data1['bookInfo']['Pages'])