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

File "./redis-monitor.py", line 206, in run #103

Open
MyselfWarmHome opened this issue Jan 18, 2019 · 6 comments
Open

File "./redis-monitor.py", line 206, in run #103

MyselfWarmHome opened this issue Jan 18, 2019 · 6 comments

Comments

@MyselfWarmHome
Copy link

Traceback (most recent call last):

File "./redis-monitor.py", line 206, in run
used_memory, peak_memory)
File "/home/omsadmin/redis-monitor/nkrode-RedisLive-e1d7763/src/dataprovider/redisprovider.py", line 30, in save_memory_info
self.conn.zadd(server + ":memory", str(timeutils.convert_to_epoch(timestamp)), data)
File "/usr/local/python/lib/python2.7/site-packages/redis/client.py", line 2263, in zadd
for pair in iteritems(mapping):
File "/usr/local/python/lib/python2.7/site-packages/redis/_compat.py", line 94, in iteritems
return x.iteritems()
AttributeError: 'str' object has no attribute 'iteritems'

@nonomal
Copy link

nonomal commented Feb 3, 2019

@MyselfWarmHome Have you solved it?

@greatvovan
Copy link

greatvovan commented Feb 12, 2019

@MyselfWarmHome, @nonomal
Revert the latest version of redis lib to a 2.. (e.g. 2.10.6). The API has changed: https://pypi.org/project/redis/#description

The proper fix would be changing the code, but I don't want to touch this old version of Python...

@nonomal
Copy link

nonomal commented Feb 23, 2019

@greatvovan “Revert the latest version of redis lib to a 2.. (e.g. 2.10.6)”
I don't quite understand, is the version of Redis that I upgraded?

I used redis3.2.6, you said that the 2.10.6 version made me doubt, my python is 2.7.15 (I just thought that there is a problem with the default 2.7.5 version), so I hope to get the answer.

@greatvovan
Copy link

@nonomal I did not say that the 2.10.6 version made you doubt.

I am saying, if you are experiencing the same problem as in the one in the first post, it is due to Redis library version (it is called redis and specified without version in the requirements.txt file). Since the version 3.*.* they changed API, which causes the problem. It has nothing to do with your Python version.

@nonomal
Copy link

nonomal commented Feb 23, 2019

@greatvovan
Thank you very much, I use the command:
Pip uninstall redis
Pip install -v redis==2.10.6
Successfully solved this problem, thank you

I hope I can contact the redislive author to coordinate the problem. Is there any plan for this?

@zanxu2016
Copy link

I have the same problem.Here is my solution.
Open the file

redisprovider.py

in the directory of

.../src/dataprovider

, around line 30 is the code

self.conn.zadd(server + ":memory", str(timeutils.convert_to_epoch(timestamp)), data)

. Try to remove the second paramter

str(timeutils.convert_to_epoch(timestamp))

, and leave the code like

self.conn.zadd(server + ":memory", data)

. Then the problem has gone.

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

4 participants