[issue41035] zipfile.Path does not work properly with zip archives where paths start with /

2020-06-22 Thread sorrow
sorrow added the comment: >`iteritems()` I meant `iterdir()` of course. -- ___ Python tracker <https://bugs.python.org/issue41035> ___ ___ Python-bugs-lis

[issue41035] zipfile.Path does not work properly with zip archives where paths start with /

2020-06-22 Thread sorrow
sorrow added the comment: Here's what I came up with: ```python class ZipPath(zipfile.Path): def __init__(self, root, at=""): super().__init__(root, at) if not at.startswith("/") and self.root.namelist()[0].startswith("/"): self.at = f&quo

[issue41035] zipfile.Path does not work properly with zip archives where paths start with /

2020-06-21 Thread sorrow
sorrow added the comment: >When the class is created? I mean the class instance -- ___ Python tracker <https://bugs.python.org/issue41035> ___ ___ Python-

[issue41035] zipfile.Path does not work properly with zip archives where paths start with /

2020-06-21 Thread sorrow
sorrow added the comment: >`Path` public AP. API of course -- ___ Python tracker <https://bugs.python.org/issue41035> ___ ___ Python-bugs-list mai

[issue41035] zipfile.Path does not work properly with zip archives where paths start with /

2020-06-21 Thread sorrow
sorrow added the comment: >how common is this use-case I don't know about that. I just know that I have to make my program work with these files. Asking the clients to stop using this (presumably incorrect) format (or the program that makes it) is not an option. >It appears th

[issue41035] zipfile.Path does not work properly with zip archives where paths start with /

2020-06-20 Thread sorrow
sorrow added the comment: >It seems you may have discovered a use-case that violates that expectation, a >case where `/a.txt` is identical to `a.txt`. The thing is: it's not. >Can you tell me more about your use-case and why zipp.Path/zipfile.Path should >support it?

[issue41035] zipfile.Path does not work properly with zip archives where paths start with /

2020-06-19 Thread sorrow
New submission from sorrow : I encountered errors when I had to work with ZPI file where path start with "/" -- components: Library (Lib) messages: 371880 nosy: sorrow priority: normal severity: normal status: open title: zipfile.Path does not work properly with zip arch

[issue41035] zipfile.Path does not work properly with zip archives where paths start with /

2020-06-19 Thread sorrow
sorrow added the comment: >>> import zipfile >>> import io >>> data = io.BytesIO() >>> zf = zipfile.ZipFile(data, 'w') >>> zf.writestr('/a.txt', 'content of a') >>> zf.filename = 'a