fate0 / pychrome

A Python Package for the Google Chrome Dev Protocol [threading base]
Other
612 stars 112 forks source link

Chrome 120 JSONDecodeError #64

Open cyberfuhrer opened 11 months ago

cyberfuhrer commented 11 months ago

After updating Chrome to version 120, an empty JSON is received:

File "/lib/python3.9/site-packages/pychrome/tab.py", line 122, in _recv_loop
message = json.loads(message_json)
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

It appears that the error is triggered when calling tab.stop()

SeanThomas11 commented 10 months ago

I have the same error when calling tab.stop() and/or browser.close_tab(tab) running Chromium 120.0.6099.199:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.9/dist-packages/pychrome/tab.py", line 122, in _recv_loop
    message = json.loads(message_json)
  File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.9/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)
timtheguy commented 6 months ago

I'm having the same issue on Chrome 124.0.6367.93, MacOS.

When calling the following:

browser.close_tab(tab)

I get the same error:

Traceback (most recent call last):
  File "/Users/user/.pyenv/versions/3.8.10/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/Users/user/.pyenv/versions/3.8.10/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/user/.pyenv/versions/3.8.10/lib/python3.8/site-packages/pychrome/tab.py", line 122, in _recv_loop
    message = json.loads(message_json)
  File "/Users/user/.pyenv/versions/3.8.10/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/Users/user/.pyenv/versions/3.8.10/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Users/user/.pyenv/versions/3.8.10/lib/python3.8/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)
ccianflone commented 2 months ago

Same issue here.