pysys.utils.fileunzip module

pysys.utils.fileunzip.unzip(zfilename, replace=False, binary=False)[source]

Unzip a .gz archive and write the contents to disk.

The method will unpack a file of the form file.data.gz to file.data, removing the archive file in the process if the replace input parameter is set to true.

By default the unpacked archive is treated as non-binary data, unless the binary input parameter is set to true.

Parameters:
  • zfilename – The full path to the archive file.
  • replace – Boolean flag to indicate if the archive file should be removed after unpacking.
  • binary – Boolean flag to indicate if the unzipped file should be written as binary. The default value of False indicates that on some platforms newline characters will be converted to the operating system default.
Raises:
  • FileNotFoundException – Raised if the archive file does not exist.
  • IncorrectFileTypeEception – Raised if the archive file does not have a .gz extension.
pysys.utils.fileunzip.unzipall(path, binary=False)[source]

Unzip all .gz files in a given directory.

Archive files are automatically deleted after unzipping.

Parameters:
  • path – The full path to the directory containing the archive files.
  • binary – Boolean flag to indicate if the unzipped files should be written as binary. The default value of False indicates that on some platforms newline characters will be converted to the operating system default.
Raises:

FileNotFoundException – Raised if the directory path does not exist.