Vertec Python module “ziputils”

The Vertec Python module “ziputils” for compressing files and creating .zip files.

Operating mode

Cloud Suite

|

ON-PREMISES

Modules

Services & CRM

Budget & Phases

Purchases

Resource Planning

Business Intelligence

Created: 15.05.2025
Machine translated
Updated: 15.05.2024 | Outsourced from article Vertec Python functions.

The Vertec Python Module ziputils allows you to compress files and .zip Create file. It is also available in Resctict scripting mode and includes the following methods:

Function Description Sample code
createzip(contentlist): bytestream

Compresses the passed files and returns them as a bytestream. This can be stored or downloaded as Filename.zip.

The contentlist is a list of tuples from file name and file content [(filename, content)].

import ziputils

(name, file) = vtcapp.requestfilefromclient("Dokument auswählen", r"C:", "Word|*.docx")
myzip = ziputils.createzip([(name, file)])
vtcapp.sendfile(myzip, 'ziptest.zip', True)
readnames(zipcontent): stringlist

Returns a list of file names contained in the .zip file (zipcontent).  

If the .zip file has a folder structure, the names include the paths separated with slashes (/).

(name, file) = vtcapp.requestfilefromclient("ZIP-File auswählen", r"C:", "ZIP|*.zip")
namelist = ziputils.readnames(file)
readbyname(zipcontent, name): content
Reads a file based on its name (name) from the .zip file (zipcontent) and returns the content of the file.
mycontent = ziputils.readbyname(file, name)
readbyindex(zipcontent, index): content
Reads a file based on its position (index) from the .zip file (zipcontent) and returns the content of the file.
mycontent = ziputils.readbyindex(file, 0)

The ziputils module is also available as a Python Stub File.

Netherlands

United Kingdom