Skip to content

JSONDecodeError when importing gradio behind firewall #4237

Description

@davidai

Describe the bug

When simplejson package is installed and trying to import gradio on a machine without an external internet connection, JSONDecodeError occurs.

I plan to submit a PR for this issue.

Is there an existing issue for this?

  • I have searched the existing issues

Reproduction

import gradio

Screenshot

No response

Logs

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/simplejson/__init__.py", line 514, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.8/dist-packages/simplejson/decoder.py", line 386, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.8/dist-packages/simplejson/decoder.py", line 416, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
 
During handling of the above exception, another exception occurred:
 
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/dist-packages/gradio/strings.py", line 38, in get_updated_messaging
    updated_messaging = requests.get(MESSAGING_API_ENDPOINT, timeout=3).json()
  File "/usr/local/lib/python3.8/dist-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

System Info

gradio 3.29.0, Python 3.8.10, Ubuntu 20.04.4 LTS

Severity

blocking all usage of gradio

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions