python-quickbooks icon indicating copy to clipboard operation
python-quickbooks copied to clipboard

simplejson optional

Open j-walker23 opened this issue 5 years ago • 2 comments

Hello, great lib. Super nice and easy.

Any chance simplejson dependency can be made optional, pretty please?

Apparently everything in my app uses simplejson if it exists, and I can't figure out the endless decode errors.

Thank you.

j-walker23 avatar Oct 12 '19 17:10 j-walker23

Not sure if that is possible. Maybe I can help with your problem. If you will add your error to this issue, I will take a look.

ej2 avatar Oct 12 '19 17:10 ej2

This was super confusing because the errors were happening in places I was already catching and sometimes expecting a JSONDecodeError.

Basically, none of my code places like below work anymore.

  from json import JSONDecodeError
  try:
    data = json.loads(data)
  except JSONDecodeError:
    pass

I would have to change them all to simplejson.errors.JSONDecodeError.

From my reading, simplejson is not used anymore in python3. And all major libs at most, make it optional.

Or remove it entirely. https://github.com/psf/requests/issues/3052

j-walker23 avatar Oct 14 '19 04:10 j-walker23

@ej2 I second this, in a Py3 environment simplejson makes little sense. It's a pity because requests will start using it if it finds it installed and then breaks tests in funny ways. Could you consider a PR that removes simplejson ?

pablogamboa avatar May 21 '24 08:05 pablogamboa

Absolutely @pablogamboa.

ej2 avatar May 21 '24 13:05 ej2

Sent a PR that removes simplejson @ej2 added rationale in the PR description. PTAL 🙏

pablogamboa avatar May 30 '24 05:05 pablogamboa