[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 ___ ___ Python-bugs-list mailing

[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"/{at}" def __repr__(self): return (

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

2020-06-21 Thread Jason R. Coombs
Jason R. Coombs added the comment: Yes, I generally agree with your assessment. Let me know if you have any questions about the implementation as you're exploring a solution. -- ___ Python tracker

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

2020-06-21 Thread Jason R. Coombs
Change by Jason R. Coombs : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[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 ___ ___ Python-bugs-list

[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 ___ ___ Python-bugs-list mailing list

[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 the file your

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

2020-06-21 Thread Jason R. Coombs
Jason R. Coombs 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. I think maybe you misunderstood. I mean that the zipfile you have seems to be treating `/a.txt` as a

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

2020-06-21 Thread Jason R. Coombs
Jason R. Coombs added the comment: I created [jaraco/zipp#56](https://github.com/jaraco/zipp/issues/56) to track the issue in the backport. -- ___ Python tracker ___

[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? I received a .zip

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

2020-06-20 Thread Jason R. Coombs
Jason R. Coombs added the comment: Thanks sorrow for filing a report. I primarily developed this functionality. As I did, I found the 'zip' format to be under-specified, so I used real-world examples as models to infer a spec. It seems you may have discovered a use-case that violates that

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

2020-06-20 Thread Brett Cannon
Change by Brett Cannon : -- nosy: +alanmcintyre, serhiy.storchaka, twouters ___ Python tracker ___ ___ Python-bugs-list mailing

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

2020-06-20 Thread Brett Cannon
Change by Brett Cannon : -- nosy: +jaraco ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[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 archives where

[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 = 'abcde.zip' >>> root = zipfile.Path(zf) >>> list(root.iterdir()) [] >>> root.exists() False --