【发布时间】:2019-02-27 10:19:49
【问题描述】:
我无法在 python 中提取 tar 文件。
这是我用来在 Python 中提取 tar 文件的代码库。
file_path = os.path.join(extracted_tar_files, file.strip('.tar'))
tf = tarfile.open(os.path.join(files_directory, file))
tf.extractall(file_path)
tf.close()
一些 tar 文件运行良好。一些 tar 文件出现以下错误。
*** PermissionError: [Errno 13] Permission denied: '\home\piercer\etc.sudoers'
你能帮帮我吗?谢谢!
【问题讨论】:
-
这似乎是 Unix 问题而不是 Python 问题。为什么不尝试使用
tar在命令行中提取并修复权限? -
@firefrorefiddle 这在普通 Windows WinZip 模块上工作。我需要在 python 中进行这种提取
标签: python-3.x python-2.7 tarfile