Skip to content

TypeError when executing jsonget with pipeline for key that does not exist #44

@mnoop

Description

@mnoop

If you execute jsonget on the Client and the key does not exist, it will catch the TypeError and instead return None, as expected.

If you execute jsonget on a pipeline and the key does not exist, it will throw the TypeError that results from json decoding the None value. Because of this, I cannot get any of the other results from the other commands from the pipeline.

Python 3.6.9
rejson 0.5.4

Traceback (most recent call last):
  File "test.py", line 7, in <module>
    result = pipeline.execute()
  File "/home/user/.local/lib/python3.6/site-packages/redis/client.py", line 4019, in execute
    return execute(conn, stack, raise_on_error)
  File "/home/user/.local/lib/python3.6/site-packages/redis/client.py", line 3943, in _execute_transaction
    r = self.response_callbacks[command_name](r, **options)
  File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: expected string or bytes-like object
import rejson

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

pipeline = rj.pipeline()
pipeline.jsonget("gdrbhiserbgherigh")
result = pipeline.execute()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions