Ronald Oussoren <ronaldousso...@mac.com> added the comment:
The repr() output of a ZipInfo contains filemode, but it is not an attribute of those objects, see <https://docs.python.org/3/library/zipfile.html#zipinfo-objects> for a list of attributes and methods. Adding an @property for mode that extracts the mode (as an integer) from the external_attr could be useful, that avoids having to know about that encoding in users of the library. You currently have to extract the mode yourself. Luckily that isn't too hard, basically: ```mode = info.external_attr >> 16```. Only use this when the value is not 0, as it will be zero when the archive was created by software that doesn't store a mode. You can convert this integer to a human readable string using the function stat.filemode(). I've changed the version to 3.11 because adding a mode attribute to ZipInfo would be a new feature and is therefore only possible in a new feature release. ---------- title: ZipInfo crashes on filemode -> filemode in repr of ZipInfo, but is not a ZipInfo attribute versions: +Python 3.11 -Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44841> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com