laixintao / iredis

Interactive Redis: A Terminal Client for Redis with AutoCompletion and Syntax Highlighting.
https://iredis.xbin.io
BSD 3-Clause "New" or "Revised" License
2.55k stars 111 forks source link

Redis for windows version error #418

Closed albertandking closed 2 years ago

albertandking commented 2 years ago
  1. Redis for windows version 5.0.14.1
  2. when type iredis in cmd, it will report : image
  3. it will be x.x.x is right, but x.x.x.x is wrong
  4. May be it should fix version validate
laixintao commented 2 years ago

hi @jindaxiang Thanks for reporting.

I didn't realize that redis has that kind of versioning.

It turns out that it was Python's builtin's parse logic:

python
Python 3.7.5 (default, Sep  2 2021, 16:30:33) 
[Clang 12.0.5 (clang-1205.0.22.11)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from distutils.version import StrictVersion
>>> StrictVersion("5.0.14.1")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/xintao.lai/.pyenv/versions/3.7.5/lib/python3.7/distutils/version.py", line 40, in __init__
    self.parse(vstring)
  File "/Users/xintao.lai/.pyenv/versions/3.7.5/lib/python3.7/distutils/version.py", line 137, in parse
    raise ValueError("invalid version number '%s'" % vstring)
ValueError: invalid version number '5.0.14.1'

However, https://github.com/pypa/packaging handles this very well. I will switch to it.

>>> from packaging.version import Version, parse
>>> a = parse("5.0.14.1")
>>> a
<Version('5.0.14.1')>
laixintao commented 2 years ago

Can you try the latest version to see if it is resolved? thanks

https://github.com/laixintao/iredis/releases/tag/v1.11.1

albertandking commented 2 years ago

Thanks for your kingly contributition! It works now! Iredis is so nice tool!