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

if msgpack installed : ValueError: Invalid encoding raw given #56

Open
llicour opened this issue Nov 3, 2020 · 0 comments
Open

if msgpack installed : ValueError: Invalid encoding raw given #56

llicour opened this issue Nov 3, 2020 · 0 comments

Comments

@llicour
Copy link

llicour commented Nov 3, 2020

if msgpack package (that is a newer version of msgpack-python) is already installed in venv, rma have the following backtrace

Traceback (most recent call last):
  File "/Users/xxx/.pyenv/versions/venv-py37/bin/rma", line 11, in <module>
    load_entry_point('rma', 'console_scripts', 'rma')()
  File "/Users/xxx/Documents/Workspace/redis-memory-analyzer/rma/cli/rma_cli.py", line 109, in main
    app.run()
  File "/Users/xxx/Documents/Workspace/redis-memory-analyzer/rma/application.py", line 127, in run
    for v in scanner.scan(limit=self.limit):
  File "/Users/xxx/Documents/Workspace/redis-memory-analyzer/rma/scanner.py", line 100, in scan
    'encoding': redis_encoding_str_to_id(key_encoding),
  File "/Users/xxx/Documents/Workspace/redis-memory-analyzer/rma/redis_types.py", line 58, in redis_encoding_str_to_id
    raise ValueError("Invalid encoding `%s` given" % key_encoding)
ValueError: Invalid encoding `raw` given

This is because of msgpack seems to return str instead of bytes
Adding bytes conversion could resolve that

def redis_encoding_str_to_id(key_encoding):
    key_encoding = key_encoding.encode("utf8")
    if key_encoding in REDIS_ENCODING_STR_TO_ID_LIB:
        return REDIS_ENCODING_STR_TO_ID_LIB[key_encoding]

    raise ValueError("Invalid encoding `%s` given" % key_encoding)
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