[ python-Bugs-1514451 ] zipfile "append" mode should create a file if not present

SourceForge.net noreply at sourceforge.net
Sat Jul 8 19:38:49 CEST 2006


Bugs item #1514451, was opened at 2006-06-29 09:42
Message generated for change (Comment added) made by greg
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1514451&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Ritesh Raj Sarraf (riteshsarraf)
Assigned to: Nobody/Anonymous (nobody)
Summary: zipfile "append" mode should create a file if not present

Initial Comment:
The line 

filename = zipfile.ZipFile(zip_file_name, "a") 

throws an exception if the given filename is not 
present already.

Shouldn't it create a file (in case one is not there) 
since it is "append" mode ??

It's throwing an OSError Exception stating "No such 
file/directory".

Normal convention has been that when opening a file 
in append mode, if the file is not present a new file 
is created.

Why is this non-standard?

----------------------------------------------------------------------

>Comment By: Gregory P. Smith (greg)
Date: 2006-07-08 10:38

Message:
Logged In: YES 
user_id=413

I agree.  append semantics generally mean append or create.

+1 from me on fixing this bug.

if any existing code is depending on the side effect from
opening a zip file in 'a' mode to tell them that it doesn't
already exist this change would break that; but I'd argue
that such code is already broken and should be cleaned up.


----------------------------------------------------------------------

Comment By: Thomas Lee (krumms)
Date: 2006-07-05 19:31

Message:
Logged In: YES 
user_id=315535

Patch #1517891 resolves this. See:

http://sourceforge.net/tracker/index.php?func=detail&aid=1517891&group_id=5470&atid=305470

Waiting for review.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1514451&group_id=5470


More information about the Python-bugs-list mailing list