免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2194 | 回复: 1
打印 上一主题 下一主题

[FastDFS] FastDFS Python Client Error: 没有 sendfile 模块 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-12-06 10:11 |只看该作者 |倒序浏览
本帖最后由 viczzx 于 2013-12-06 10:23 编辑

我是按照README.md上的步骤进行操作的

1. $ sudo python setup.py install
2. $ python # run into python prompt, the version of mine is Python 2.7.3
3. >>> from fdfs_client.client import*

到这就出现了错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "fdfs_client/client.py", line 14, in <module>
    from fdfs_client.storage_client import *
  File "fdfs_client/storage_client.py", line 12, in <module>
    from fdfs_client.sendfile import *
ImportError: No module named sendfile


上面说的是fdfs_client中没有sendfile模块,在编译好的 build/lib.linux-x86_64-2.7/fdfs_client/  中确实没有sendfile.py模块,只有sendfile.so文件,我看到源文件中sendfile.c 是C语言写的,在执行 sudo python setup.py install 的时候,确实也显示了 build extention module sendfile 这样的提示,但是最后确实还是用不了,我的Python版本是2.7.3,在Ubuntu 12.04下。

所以,这个问题是由于版本问题吗?怎样解决这个问题呢?为什么用C语言来写sendfile模块呢?怎样使用sendfile模块呢?

谢谢!!!

论坛徽章:
0
2 [报告]
发表于 2013-12-06 13:35 |只看该作者
看来没有回答,我自己跟进下这个问题。

在编译好的fdfs_client package下确实没有sendfile.py模块,可以到/usr/local/lib/python2.7/dist-packages/fdfs_client 下进行查看,只有sendfile.so文件。

由于sendfile模块实在 fdfs_client/storage_client.py中被引入的(见上面错误提示),因此我把 storage_client.py 的第12行注释掉了,再一次重新建立: $ sudo python setup.py install,然后再按照README.md提示进行一步步操作,使用 upload_by_filename() 和 download_to_file() 函数都是成功的。

这样应该就初步解决了问题。不知道以后会不会出现问题。

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP