Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It would be nice if Client was robust to simplejson vs. json #3151

Closed
zangell44 opened this issue Aug 13, 2020 · 1 comment
Closed

It would be nice if Client was robust to simplejson vs. json #3151

zangell44 opened this issue Aug 13, 2020 · 1 comment

Comments

@zangell44
Copy link
Collaborator

Description

Currently, Client._request only catches json.decoder.JSONDecoderError. However, if the simplejson library is present in the environment, requests defaults to using simplejson instead of json. psf/requests#3052

Instead of catching and raising a useful message, Prefect will raise simplejson.errors.JSONDecoderError

Expected Behavior

It would be very nice if the Client could handle both cases. I'll have a draft PR coming in a minute here.

Reproduction

  1. Install simplejson in your environment (pip install simplejson)
  2. Make sure you log out of prefect via cli prefect auth logout
  3. Run a hello world flow and try to register it
from prefect import task, Flow

@task
def say_hello():
    print("Hello, world!")

with Flow('test') as flow:
	say_hello()

flow.register(project_name='test')

Here, you'll see the simplejson error come through the stack trace instead of an error informing you about the actual issue.

Environment

pip install simplejson

@joshmeek
Copy link

Closed by #3152

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants