'Tarfile recursively opens in windows, but not in Linux [Python]
I have a Python program which extracts a zip file. The zip file looks like this:
a.zip
|
|
--- b.tar.gz
. |
. |
. --- c.tar
Here is my code:
with zipfile.ZipFile("a.zip", 'r') as zipRef:
with zipRef.open("b.tar.gz") as x:
x_filedata = io.BytesIO(x.read())
with tarfile.open(fileobj=x_filedata) as tarRef:
tarFiles = tarRef.getmembers()
for fileInTar in tarFiles:
print(fileInTar)
In Windows, this code recursively opens c.tar too and prints the contents of c.tar file. But in Centos, it prints c.tar. Why is this happening?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
