[Patches] [ python-Patches-1492704 ] distinct error type from shutil.move()
SourceForge.net
noreply at sourceforge.net
Fri Jul 6 07:25:25 CEST 2007
Patches item #1492704, was opened at 2006-05-21 20:08
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1492704&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: Library (Lib)
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Zooko O'Whielacronx (zooko)
Assigned to: Anthony Baxter (anthonybaxter)
Summary: distinct error type from shutil.move()
Initial Comment:
I need to call shutil.move() and be able to tell the
difference between an error such as access denied and
an error due to the two arguments being the same file.
--- old-dw/src/Lib/shutil.py 2006-05-22
00:06:02.000000000 -0300
+++ new-dw/src/Lib/shutil.py 2006-05-22
00:06:02.000000000 -0300
@@ -16,6 +16,9 @@
class Error(exceptions.EnvironmentError):
pass
+class SameFileError(Error):
+ pass
+
def copyfileobj(fsrc, fdst, length=16*1024):
"""copy data from file-like object fsrc to
file-like object fdst"""
while 1:
@@ -39,7 +42,7 @@
def copyfile(src, dst):
"""Copy data from src to dst"""
if _samefile(src, dst):
- raise Error, "`%s` and `%s` are the same file"
% (src, dst)
+ raise SameFileError, "`%s` and `%s` are the
same file" % (src, dst)
fsrc = None
fdst = None
----------------------------------------------------------------------
>Comment By: Neal Norwitz (nnorwitz)
Date: 2007-07-05 22:25
Message:
Logged In: YES
user_id=33168
Originator: NO
In order for patches to be applied, they require tests and doc updates as
appropriate. Can you supply these updates and attach a patch with all the
changes?
----------------------------------------------------------------------
Comment By: Zooko O'Whielacronx (zooko)
Date: 2007-06-28 08:08
Message:
Logged In: YES
user_id=52562
Originator: YES
Dear Pythonistas: please apply this patch. There is no reason not to, and
it enables programmers to use shutil more cleanly.
----------------------------------------------------------------------
Comment By: Zooko O'Whielacronx (zooko)
Date: 2006-07-06 15:55
Message:
Logged In: YES
user_id=52562
I'm not sure how to draw attention to my patch, so I will
try assigning it to anthonybaxter. That ought to get attention.
----------------------------------------------------------------------
Comment By: Zooko O'Whielacronx (zooko)
Date: 2006-07-06 15:53
Message:
Logged In: YES
user_id=52562
Please apply. This patch is completely backwards-compatible
and makes possible some uses of shutil.move().
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1492704&group_id=5470
More information about the Patches
mailing list