我正在尝试从某个存储库获取数据,并尝试显示任何文件的文件内容,例如,在存储库目录中使用cat <filename>。
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时,它会给出一个错误,该错误是由以下行引起的
assert retsize <= size, 'actual amount read %d greater than expected %d' % (retsize, size)在fusepy的读取函数link中。
https://stackoverflow.com/questions/47608292
复制相似问题