首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >读取python中的Fuse实现未按预期返回,cat:<mountpoint>:错误地址

读取python中的Fuse实现未按预期返回,cat:<mountpoint>:错误地址
EN

Stack Overflow用户
提问于 2017-12-02 21:15:19
回答 0查看 453关注 0票数 0

我正在尝试从某个存储库获取数据,并尝试显示任何文件的文件内容,例如,在存储库目录中使用cat <filename>

代码语言:javascript
复制
def read(self, path, size, offset, fh=None):
    file_content = ''
    path_ele = path.split('/')
    print('***[read]')
    print(path)
    if path.endswith('/') or path[1] == '.':
        print('ok')
        return file_content
    else:
        path = path.split('/')
        repo_name = path[-2]
        file_name = path[-1]
        print(repo_name, file_name)
        for item in self.user.get_user().get_repos():
            if item.name == repo_name:
                files = item.get_dir_contents('/')
                for file_ in files:
                    if file_name == file_.name:
                        file_content = item.get_file_contents(file_name).decoded_content
                        print(len(file_content.decode('utf-8')))
                        print(type(file_content.decode('utf-8')))
                        return file_content

当我对存储库目录中的文件执行cat时,它会给出一个错误,该错误是由以下行引起的

代码语言:javascript
复制
assert retsize <= size, 'actual amount read %d greater than expected %d' % (retsize, size)

fusepy的读取函数link中。

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47608292

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档