zlp1992 2015-11-18 08:28 采纳率: 33.3%
浏览 4038

fastdfs python客户端fdfs_client_py上传从文件问题

有人用过fdfs的python 客户端fdfs_client_py上传文件吗?我的代码如下:

     def upload_file(self,filePath=None,slaveFilePath=None): 
        #upload the apk and the apk details html file into fastdfs storage
        #apk file as master file while html file as slave file
        if filePath is None:
            return None
        ret={}
        client=Fdfs_client(self.m_clientConf)
        result=client.upload_by_filename(filePath) #upload master file
        master_fileId=''
        if result is not None: #success
            self.m_logger.info(" save %s into fdfs success"%filePath) 
            print " save %s into fdfs success"%filePath
            print result
            ret['storageIp']=result['Storage IP']
            ret['groupName']=result['Group name']
            ret['masterFileId']=result['Remote file_id']
            master_fileId=result['Remote file_id']
        print slaveFilePath,master_fileId
        if(slaveFilePath is not None): #upload slave file
            slave_res=client.upload_slave_by_filename(slaveFilePath,master_fileId,'-html')
            if slave_res is not None: #success
                self.m_logger.info(" save slave %s into fdfs success"%slaveFilePath) 
                ret['slaveFileId']=slave_res['Remote file_id']
        return ret #return the storage info

但是老是报下面的错:
图片说明
从文件老是上传不成功,但是主文件却上传成功了,当我直接指定主文件id来上传从文件时,从文件却可以上传成功,有人知道怎么解决么?

  • 写回答

1条回答 默认 最新

  • oyljerry 2015-11-18 09:37
    关注

    文件路径不正确,这个要看fastdfs 它的参数是如何设置从文件等的。

    评论

报告相同问题?

悬赏问题

  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器