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

Document differences in using Python2 and Python3 #25

Open
K-Jo opened this issue Jul 17, 2019 · 4 comments · May be fixed by #37
Open

Document differences in using Python2 and Python3 #25

K-Jo opened this issue Jul 17, 2019 · 4 comments · May be fixed by #37

Comments

@K-Jo
Copy link

K-Jo commented Jul 17, 2019

Client(decode_responses=True)

@toyg
Copy link

toyg commented Apr 4, 2020

I don't know whether to be happy that I've found this, after two hours banging my head against the screen, or to be upset that almost a year later such an essential bit is still missing from the doc.

@gkorland
Copy link
Contributor

gkorland commented Apr 4, 2020

@toyg i'm sorry you wasted two hours. But it's documented, in fact it's right on the first example in the https://github.com/RedisJSON/redisjson-py/blob/master/README.md.

   from rejson import Client, Path

   rj = Client(host='localhost', port=6379, decode_responses=True)

   # Set the key `obj` to some object
   obj = {
       'answer': 42,
       'arr': [None, True, 3.14],
       'truth': {
           'coord': 'out there'
       }
   }

And even has its own section:
https://github.com/RedisJSON/redisjson-py#encodingdecoding

Do you think we should add it somewhere else?

@toyg
Copy link

toyg commented Apr 4, 2020

I think it should be mentioned that it’s a compulsory parameter when using Python3, rather than something advanced and optional that may or may not be required. I would dare say it should be True by default, now that py2 is dead, but I guess that’s an opinion and switching it now might break old code.

@itamarhaber itamarhaber linked a pull request Apr 7, 2020 that will close this issue
@itamarhaber
Copy link
Collaborator

I've submitted #37 to fix (docs only) this - please let me know if acceptable.

After spending some cycles mulling on this, I think we can relax this requirement and have the client do the decoding of rejson's replies if it wasn't initialized with decode_responses=True. That would have probably been the right course to take all that time ago but changing now will break things :/

Perhaps it is something worth considering for the next major release @gkorland

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

Successfully merging a pull request may close this issue.

4 participants