From f270d2f26e890ba9c79c761dd5249980a1cd6f41 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 11 Sep 2013 16:08:26 +0900 Subject: [PATCH] tolerate windows trash errors --- thirdparty/send2trash/plat_win.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/thirdparty/send2trash/plat_win.py b/thirdparty/send2trash/plat_win.py index 2ee238bc8..96fc8b582 100644 --- a/thirdparty/send2trash/plat_win.py +++ b/thirdparty/send2trash/plat_win.py @@ -35,6 +35,7 @@ FOF_ALLOWUNDO = 64 FOF_NOERRORUI = 1024 def send2trash(path): + opath = path if not isinstance(path, unicode): path = unicode(path, u'mbcs') if not op.isabs(path): @@ -50,6 +51,7 @@ def send2trash(path): fileop.lpszProgressTitle = None result = SHFileOperationW(byref(fileop)) if result: - msg = u"Couldn't perform operation. Error code: %d" % result - raise OSError(msg) - + # user's system is broken, just delete + os.unlink(opath) + #msg = u"Couldn't perform operation. Error code: %d" % result + #raise OSError(msg)