1
0
mirror of https://github.com/arsenetar/send2trash.git synced 2026-01-22 14:41:40 +00:00

Converted to py3k (haven't tried it on Windows yet, but it should compile and work...)

--HG--
branch : py3k
This commit is contained in:
Virgil Dupras
2010-07-07 16:12:13 +02:00
parent 88b90d859c
commit 2858b5b153
7 changed files with 52 additions and 26 deletions

View File

@@ -4,7 +4,7 @@
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
from __future__ import unicode_literals
import sys
import os
import os.path as op
@@ -60,8 +60,8 @@ def move_without_conflict(src, dst):
os.rename(src, destpath)
def send2trash(path):
if not isinstance(path, unicode):
path = unicode(path, sys.getfilesystemencoding())
if not isinstance(path, str):
path = str(path, sys.getfilesystemencoding())
try:
move_without_conflict(path, TRASH_PATH)
except OSError: