jhao104 / SSDBAdmin

SSDB可视化界面管理工具 ssdb web manager tool
http://ssdb.io/docs/zh_cn/
Apache License 2.0
354 stars 89 forks source link

AttributeError: 'int' object has no attribute 'decode' #10

Open newhwa opened 6 years ago

newhwa commented 6 years ago

File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 2309, in call return self.wsgi_app(environ, start_response) File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 2295, in wsgi_app try: ctx.push() response = self.full_dispatch_request() except Exception as e: error = e response = self.handle_exception(e) except: error = sys.exc_info()[1] raise return response(environ, start_response) finally: File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1741, in handle_exception reraise(exc_type, exc_value, tb) File "C:\ProgramData\Anaconda3\lib\site-packages\flask_compat.py", line 35, in reraise raise value File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "C:\ProgramData\Anaconda3\lib\site-packages\flask_compat.py", line 35, in reraise raise value File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1799, in dispatch_request return self.view_functionsrule.endpoint File "C:\Users\\Python\jhao104\SSDBAdmin\SSDBAdmin\apps\index.py", line 34, in index server_info = SSDBClient(request).serverInfo() File "C:\Users\\Python\jhao104\SSDBAdmin\SSDBAdmin\model\SSDBClient.py", line 51, in serverInfo infolist = [.decode() for _ in self.conn.execute_command('info')] File "C:\Users\\Python\jhao104\SSDBAdmin\SSDBAdmin\model\SSDBClient.py", line 51, in infolist = [.decode() for _ in self.conn.execute_command('info')] AttributeError: 'int' object has no attribute 'decode'

jhao104 commented 6 years ago

@newhwa 拉的那个版本,用的python那个版本?

newhwa commented 6 years ago

@newhwa 拉的那个版本,用的python那个版本?

Python 3.6.6+

@newhwa 拉的那个版本,用的python那个版本?

最近用 git clone https://github.com/jhao104/SSDBAdmin.git 安装, 应该就是master 最新版本 $python --verson

Python 3.6.6+

jhao104 commented 6 years ago

https://github.com/jhao104/SSDBAdmin/blob/e7c02579e6421cb2deab901c4aad202b3d8ae383/SSDBAdmin/model/SSDBClient.py#L51

看日志像是info出来的有int型; 你试试改成 info_list = [_ if isinstance(_,int) else _.decode() for _ in self.__conn.execute_command('info')]

我这边测试info出来的都是byte,如果可以的话告诉我一声。我改下

liuxthu commented 5 years ago

您好,目前解析出现几个问题: 1 [.decode() for in self.__conn.execute_command('info')] 解析出来全是数字,无法一一对应,如果按建议中更改的话,def _parseDiskUsage(_stats):出问题 2 除主页功能外,其他功能要么提示响应错误,要不是无相关命令unknown command 'hlist' 、 ‘qlist’等,是否需要安装另外的环境

jhao104 commented 5 years ago

您好,目前解析出现几个问题: 1 [.decode() for in self.__conn.execute_command('info')] 解析出来全是数字,无法一一对应,如果按建议中更改的话,def _parseDiskUsage(_stats):出问题 2 除主页功能外,其他功能要么提示响应错误,要不是无相关命令unknown command 'hlist' 、 ‘qlist’等,是否需要安装另外的环境

你拉的哪个分支代码? 用的什么python版本

liuxthu commented 5 years ago

您好,目前解析出现几个问题: 1 [.decode() for in self.__conn.execute_command('info')] 解析出来全是数字,无法一一对应,如果按建议中更改的话,def _parseDiskUsage(_stats):出问题 2 除主页功能外,其他功能要么提示响应错误,要不是无相关命令unknown command 'hlist' 、 ‘qlist’等,是否需要安装另外的环境

你拉的哪个分支代码? 用的什么python版本

抱歉,现在才回复。我摘取的是主分支,python版本 3.6

testerSunshine commented 5 years ago

SSDBAdmin/SSDBAdmin/model/SSDBClient.py Line 51 in e7c0257 infolist = [.decode() for _ in self.conn.execute_command('info')] 看日志像是info出来的有int型; 你试试改成 `infolist = [ if isinstance(,int) else .decode() for _ in self.conn.execute_command('info')] `

我这边测试info出来的都是byte,如果可以的话告诉我一声。我改下

[2018-12-03 17:23:18,980] ERROR in app: Exception on /ssdbadmin/queue/ [GET]
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/py_work/SSDBAdmin/SSDBAdmin/apps/queue.py", line 36, in queueLists
    page_size=int(page_size))
  File "/usr/local/py_work/SSDBAdmin/SSDBAdmin/model/SSDBClient.py", line 82, in queueList
    items_list = [_.decode() for _ in self.__conn.execute_command('qlist', name_start, name_end, limit)]
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/redis/client.py", line 668, in execute_command
    return self.parse_response(connection, command_name, **options)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/redis/client.py", line 680, in parse_response
    response = connection.read_response()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/redis/connection.py", line 629, in read_response
    raise response
redis.exceptions.ResponseError: unknown command 'qlist'

按照上述改完之后,出现另外一个问题, python版本: Python 3.6.3 (v3.6.3:2c5fed86e0, Oct 3 2017, 00:32:08)

jhao104 commented 5 years ago

@testerSunshine 兄弟 这是ssdb工具 你不会连的是redis吧 qlist就是ssdb支持的命令啊 怎么会unknown command 'qlist' http://ssdb.io/docs/zh_cn/commands/index.html

Goldtype commented 5 years ago

@testerSunshine兄弟这是SSDB工具你不会连的是redis的吧 qlist就是SSDB支持的命令啊怎么会未知命令'的QList' http://ssdb.io/docs/zh_cn/commands/index.html

我连接的是redis,请问这个工具可以兼容redis嘛

这个问题这样调整就不会报错了 info_list = [str(_) for _ in self.__conn.execute_command('info')] # _.decode() 修改为str

Goldtype commented 5 years ago

我是在 jhao104/proxy_pool 这个项目里看到作者推荐的有您的项目,于是使用的,以为可以兼容redis,如果不能兼容,我还是装个SSDB再看看

jhao104 commented 5 years ago

我是在 jhao104/proxy_pool 这个项目里看到作者推荐的有您的项目,于是使用的,以为可以兼容redis,如果不能兼容,我还是装个SSDB再看看

redis的可视化工具有很多的,网上一大堆。这是只是为ssdb写的一个工具

Goldtype commented 5 years ago

我是在jhao104 / proxy_pool这个项目里看到作者推荐的有您的项目,于是使用的,以为可以兼容redis的,如果不能兼容,我还是装个SSDB再看看

Redis的的可视化工具有很多的,网上一大堆。这是只是为SSDB写的一个工具

感谢回复,我已经开始使用SSDB了。有些小问题如果您有空的话,希望解答一下。

SSDB的hash中 能否高效的根据 value找key (我通过hkeys、hget 可以实现这个需求,但是效率太慢了,2万条数据查了2分钟,可能是我的使用方法不对,请问有什么可以优化的途径)