Skip to content

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

@llicour

Description

@llicour

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)

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