Questions tagged [tarfile]

either a tar archive file or a Python module used to handle tar archive files

The term "tar file" can refer to either an archive file created with the UNIX tar command (also called a tarball) or the Python tarfile module that is used to read, write, and manage these files.

Resources

Related Tags

231 questions
-1
votes
2 answers

Tkinter Treeview for Tarfile items

I'm having trouble writing a function that could take a list of tarfile items via the .getmembers() method and put them in a proper tree structure (files within folders and subfolders) in the Treeview widget. I found a post similar to what I wanted:…
Jimmy-John
  • 31
  • 1
  • 8
-1
votes
1 answer

extracting list of xml files from tar.gz file from ftp server

I need to extract a list of xml files that are in a tar.gz file that I'm trying to read. I tried this: import os from ftplib import FTP def writeline(data): filedata.write(data) filedata.write(os.linesep) ftp =…
Hadas
  • 41
  • 1
  • 11
-1
votes
1 answer

move files from child directories (from unzipping) to parent directory in unzip step?

I've got a specific problem: I am downloading some large sets of data using requests. Each request provides me with a compressed file, containing a manifest of the download, and folders, each containing 1 file. I can unzip the archive + remove…
MHeydt
  • 135
  • 8
-1
votes
1 answer

Why does using tarfile.extract() result in error: no attribute 'extract'?

I'm using Python 3.4. Writing csv_f = tarfile.open('C:\\Users\\somefile.gz') works fine but this csv_f = tarfile.extract('C:\\Users\\somefile.gz') causes the response AttributeError: 'module' object has no attribute 'extract' It seems the…
William
  • 59
  • 8
-1
votes
1 answer

Reading .tar.Z file without decompressing in Python 2.7

I am new to Python and trying to read .tar.Z file name and trying to list the file names compressed inside it. I just need to know the file name and size. I am using Python 2.7. I am able to do it with .tar file. Can somebody explain that with an…
-2
votes
3 answers

How to solve AttributeError: __enter__?

Here is the relevant code: for file in files: with readfile(file) as openfile: molecules.append(process_file_fn(openfile)) and I am getting this error from the code above: src/datamodules/components/edm/process.py",…
1 2 3
15
16