FDFS报错 raise DataError(errmsg + '(uploading)')

在测试FDFS与python交互时,输入以下代码,这是官方文档的代码,当我输入
ret = client.upload_by_filename(‘test’)后,就报错了。
这里写图片描述

错误如下:
Traceback (most recent call last):
File “”, line 1, in
File “/root/.virtualenvs/Cole_py3/lib/python3.6/site-packages/fdfs_client/client.py”, line 88, in upload_by_filename
raise DataError(errmsg + ‘(uploading)’)
fdfs_client.exceptions.DataError: [-] Error: test1 is not a file.(uploading)

主要还是太天真了,以为按照官方测试代码输入就没错,后来查看了client.py的代码,才发现,ret = client.upload_by_filename(’ ‘) 括号里面填写的是要在你本机存在的文件名或者文件路径
ret = client.upload_by_filename(’ /home/cole/python/test/test1.py ‘)
ret = client.upload_by_filename(’ test1.py ‘)
这两种写法都可以,前提是test1.py是要存在你本机

这里写图片描述

猜你喜欢

转载自blog.csdn.net/joe8910/article/details/82705341