Registry / devops / zipfile38

zipfile38

JSON →
library0.0.3pypypi✓ verified 83d ago

Backport of the Python 3.8 zipfile module for use with older Python versions. Provides the same API as the standard library zipfile, but with the improvements introduced in Python 3.8 (e.g., ZipFile.open() as a context manager, Path support). Currently version 0.0.3, no recent releases. Low maintenance.

pip install zipfile38
INSTALL
IMPORT
SIG · ZIPFILE38
Z
zipfile38
devopspythonv0.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ZipFile
from zipfile38 import ZipFile
import zipfile.ZipFile
zipfile38 is the top-level module, not a submodule

Basic usage: create and read zip files using ZipFile as a context manager.

from zipfile38 import ZipFile # Create a new zip file with ZipFile('example.zip', 'w') as zf: zf.write('file.txt', arcname='in_archive.txt') # Read an existing zip file with ZipFile('example.zip', 'r') as zf: print(zf.namelist()) with zf.open('in_archive.txt') as f: print(f.read())
Debug
Known issues
gotchaDo not install zipfile38 on Python 3.8 or newer; the standard library already has the features. It's intended for Python 3.6, 3.7, etc.
fix
Check sys.version_info before installing, or only install if Python < 3.8.
affects: all
deprecatedThis library is a backport of a now-stable standard library module. Future improvements will only be in the stdlib. Consider using the built-in zipfile if your Python version supports it.
fix
Use the standard library zipfile if Python >= 3.8.
affects: all
gotchaThe zipfile38 module overwrites the standard library's zipfile module's name. Be careful about mixed imports.
fix
Use 'from zipfile38 import ZipFile' explicitly rather than 'import zipfile38' to avoid confusion.
affects: all
Errors
Common errors & fixes
AttributeError: module 'zipfile38' has no attribute 'ZipFile'
Attempting to import ZipFile from the wrong location (e.g., zipfile38.ZipFile when the module is named zipfile38).
fix
Use: from zipfile38 import ZipFile
ImportError: No module named zipfile38
The zipfile38 package is not installed, or you are trying to import it on Python 3.8+ (where it is not needed).
fix
Install with pip install zipfile38, and ensure you are using Python < 3.8.
Upgrade
Version history
0.0.3latest on PyPI · released Dec 3, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
20
Resources
zipfile38 — pip install zipfile38 · libregistry