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

XINFO gives KeyError #191

Open
violet-black opened this issue Mar 31, 2021 · 0 comments
Open

XINFO gives KeyError #191

violet-black opened this issue Mar 31, 2021 · 0 comments

Comments

@violet-black
Copy link

violet-black commented Mar 31, 2021

Direct execution of XINFO STREAM via execute_command gives a KeyError since a parser expects a string key but receives a byte-string instead.

def parse_xinfo_stream(response):
    res = pairs_to_dict(response)
    if res['first-entry'] and len(res['first-entry']) > 0:

Redeclaring pairs_to_dict to:

def pairs_to_dict(response):
    "Create a dict given a list of key/value pairs"
    it = iter(response)
    return {k.decode(): v for k, v in zip(it, it)}

resolves the issue but I'm unsure if it may backfire somewhere else in the code :-)

@violet-black violet-black changed the title Streaming error (XINFO) XINFO gives KeyError Mar 31, 2021
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

1 participant