【问题标题】:Python: permission denied when extracting tar.gzPython:提取 tar.gz 时权限被拒绝
【发布时间】:2018-06-06 07:29:50
【问题描述】:

我想提取文件夹中的所有 tar.gz,但我得到 [Errno 13] 权限被拒绝。我经历过与该问题相关的不同帖子,但没有任何帮助。即使在 tar.gz 中提取特定成员也会产生相同的错误。有人可以帮忙解决什么问题吗?

I want to create a script for unzip (.tar.gz) file via (Python)

Python: Extracting specific files with pattern from tar.gz without extracting the complete file

Overwrite existing read-only files when using Python's tarfile

tar = tarfile.open(fname, "r:gz")
tar.extractall()
tar.close()

【问题讨论】:

  • 显然您没有创建新文件的权限。你的目录权限是什么?
  • 我对我的 Mac 上的目录具有读写权限

标签: python-2.7


【解决方案1】:

您是否以本地用户身份运行它?这是在 Unix/Linux 上运行的吗?运行 python 脚本的帐户是否对您尝试写入的文件夹具有适当的权限?

【讨论】:

  • 这是在 Mac OSX 上。我过去曾在同一台机器上运行此脚本。现在我想添加在同一脚本中提取 tar.gz 的功能
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-20
相关资源
最近更新 更多