5

I would like to extract all tar.gz inside a folder but I am getting [Errno 13] Permission denied. I have been through different posts related to the problem but nothing helps. Even extracting a specific member inside tar.gz gives same error. Can someone help what could be wrong?

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()
koolmrsam
  • 51
  • 4

2 Answers2

0

Are you running this as a local user? Is this running on Unix/Linux? Does the account running the python script have the appropriate rights to the folder you are attempting to write to?

Dan S.
  • 3
  • 2
  • This is on Mac OSX. I have running this script on same machine in the past. Now I want to add capability to extract tar.gz in the same script – koolmrsam Dec 24 '17 at 15:42
0

It happens when you do not have permission to the tmp folder on your system. Make a temporary directory in your home directory :

mkdir tmp_local

Try to change the tmp directory to your local folder using the following command:

export TMPDIR='/local_home/ah32097/tmp_local'

after this you can directly pip install the python package in tar.gz format.