fdfs_client.exceptions.ResponseError: Tracker response length is invaild, expect: 40, actual: 70
FastDFS的版本是最新的6.12(截至2024.05.15)升级成功后,重新执行代码,发现已经不再报错,能正常上传文件了。(需要Python3.10+)方案一:升级依赖包(
·
代码如下:
from fdfs_client.client import * # pip install fastdfs-client-py3
client = Fdfs_client(get_tracker_conf('tracker.conf'))
ret = client.upload_by_filename('test')
print(ret)
FastDFS的版本是最新的6.12(截至2024.05.15)
执行代码时,报错如下:
Traceback (most recent call last):
File "/Users/mac10.12/trying/anywhere/dd.py", line 3, in <module>
ret = client.upload_by_filename('test')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mac10.12/trying/anywhere/venv/lib/python3.11/site-packages/fdfs_client/client.py", line 86, in upload_by_filename
store_serv = tc.tracker_query_storage_stor_without_group()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mac10.12/trying/anywhere/venv/lib/python3.11/site-packages/fdfs_client/tracker_client.py", line 377, in tracker_query_storage_stor_without_group
raise ResponseError(errmsg)
fdfs_client.exceptions.ResponseError: [-] Error: Tracker response length is invaild, expect: 40, actual: 70
解决:
方案一:升级依赖包(GitHub - waketzheng/fastdfs-client-python at 1.0.1)
pip install 'git+ssh://git@github.com/waketzheng/fastdfs-client-python@1.0.1#egg=fdfs-client'
升级成功后,重新执行代码,发现已经不再报错,能正常上传文件了
方案二:改用fastdfs-client-python(需要Python3.10+)
# pip install fastdfs-client
from fastdfs_client import FastdfsClient
client = FastdfsClient('tracker.conf')
ret = client.upload_by_filename('test')
print(ret)
执行结果如下:
{
"Group name": "group1",
"Remote file_id": "group1/M00/00/00/eE0vIWZEkqGAObkhAAAZ4rQ0_gU1863.py",
"Status": "Upload successed.",
"Local file name": "kitty.py",
"Uploaded size": "6.47KB",
"Storage IP": "192.168.0.33"
}
更多关于fastdfs-client的使用见:https://blog.csdn.net/jaket5219999/article/details/138924413

GitCode 天启AI是一款由 GitCode 团队打造的智能助手,基于先进的LLM(大语言模型)与多智能体 Agent 技术构建,致力于为用户提供高效、智能、多模态的创作与开发支持。它不仅支持自然语言对话,还具备处理文件、生成 PPT、撰写分析报告、开发 Web 应用等多项能力,真正做到“一句话,让 Al帮你完成复杂任务”。
更多推荐
所有评论(0)