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.

Exception: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

See original GitHub issue

I have been using icrawler to scrap some images from Google Search. I have used this code,

from icrawler.builtin import GoogleImageCrawler

keyword = 'elon_musk'
num_images =   200
output_directory = 'dataset/images'

google_crawler = GoogleImageCrawler(storage={ 'root_dir': output_directory})
google_crawler.crawl(keyword=keyword, max_num=num_images , filters=None )

The execution ends with this exception,

Exception in thread parser-001:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.6/dist-packages/icrawler/parser.py", line 104, in worker_exec
    for task in self.parse(response, **kwargs):
  File "/usr/local/lib/python3.6/dist-packages/icrawler/builtin/google.py", line 157, in parse
    meta = json.loads(txt)
  File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/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 am using icrawler in Google Colab hence with Python version 3.6.9 on Google Chrome browser.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
gcheroncommented, Jun 15, 2020

I have proposed a fix in PR #74

1reaction
xbreidcommented, Jun 24, 2020

I have proposed a fix in PR #74

Can confirm this PR fixes the issue for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Your code produced an empty response body, you'd want to check for that or catch the exception raised. It is possible the server...
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 >
JSONDecodeError Expecting value line 1 column 1 char 0
I am facing an error when decoding JSON. Expecting value: line 1 column 1 (char 0) The ... a curl request. Can someone...
Read more >
json.decoder.jsondecodeerror: expecting value: line 1 column ...
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 >

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