(self, zinfo)
Check for errors before writing a file to the archive.
Check for errors before writing a file to the archive.
Check for errors before writing a file to the archive .
def _writecheck(self, zinfo):
        """Check for errors before writing a file to the archive."""
        if zinfo.filename in self.NameToInfo:
            if self.debug:      # Warning for duplicate names
                print("Duplicate name:", zinfo.filename)
        if self.mode not in ("w", "a"):
            raise RuntimeError('write() requires mode "w" or "a"')
        if not self.fp:
            raise RuntimeError(
                  "Attempt to write ZIP archive that was already closed")
        if zinfo.compress_type == ZIP_DEFLATED and not zlib:
            raise RuntimeError(
                  "Compression requires the (missing) zlib module")
        if zinfo.compress_type not in (ZIP_STORED, ZIP_DEFLATED):
            raise RuntimeError("That compression method is not supported")
        if zinfo.file_size > ZIP64_LIMIT:
            if not self._allowZip64:
                raise LargeZipFile("Filesize would require ZIP64 extensions")
        if zinfo.header_offset > ZIP64_LIMIT:
            if not self._allowZip64:
                raise LargeZipFile(
                      "Zipfile size would require ZIP64 extensions")
def _writecheck ( self , zinfo ) : if zinfo . filename in self . NameToInfo : if self . debug : # Warning for duplicate names print ( "Duplicate name:" , zinfo . filename ) if self . mode not in ( "w" , "a" ) : raise RuntimeError ( 'write() requires mode "w" or "a"' ) if not self . fp : raise RuntimeError ( "Attempt to write ZIP archive that was already closed" ) if zinfo . compress_type == ZIP_DEFLATED and not zlib : raise RuntimeError ( "Compression requires the (missing) zlib module" ) if zinfo . compress_type not in ( ZIP_STORED , ZIP_DEFLATED ) : raise RuntimeError ( "That compression method is not supported" ) if zinfo . file_size > ZIP64_LIMIT : if not self . _allowZip64 : raise LargeZipFile ( "Filesize would require ZIP64 extensions" ) if zinfo . header_offset > ZIP64_LIMIT : if not self . _allowZip64 : raise LargeZipFile ( "Zipfile size would require ZIP64 extensions" )