This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ronaldoussoren
Recipients G.Rakosy, iritkatriel, ronaldoussoren
Date 2021-09-30.18:50:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1633027844.92.0.0757568607046.issue44841@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-09-30 18:50:44ronaldoussorensetrecipients: + ronaldoussoren, iritkatriel, G.Rakosy
2021-09-30 18:50:44ronaldoussorensetmessageid: <1633027844.92.0.0757568607046.issue44841@roundup.psfhosted.org>
2021-09-30 18:50:44ronaldoussorenlinkissue44841 messages
2021-09-30 18:50:44ronaldoussorencreate