Skip to content

Commit

Permalink
unicode fix
Browse files Browse the repository at this point in the history
fixes more unicode problems with the moveto and copyto features
  • Loading branch information
Michael Higgins committed Sep 26, 2014
1 parent f9f6ff4 commit f8854fe
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions mkvtomp4.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,12 @@ def replicate(self, inputfile, relativePath=None):
shutil.copy(inputfile, d)
print "Copy succeeded"
except Exception as e:
print "Unable to create additional copy of file in %s" % (d)
print e
try:
shutil.copy(inputfile.decode(sys.getfilesystemencoding()), d)
print "Copy succeeded"
except Exception as e:
print "Unable to create additional copy of file in %s" % (d)
print e
if self.moveto:
moveto = os.path.join(self.moveto, relativePath) if relativePath else self.moveto
if not os.path.exists(moveto):
Expand All @@ -462,8 +466,12 @@ def replicate(self, inputfile, relativePath=None):
shutil.move(inputfile, moveto)
print "File moved to %s" % (moveto)
except Exception as e:
print "Unable to move file to %s" % (moveto)
print e
try:
shutil.move(inputfile.decode(sys.getfilesystemencoding()), moveto)
print "File moved"
except Exception as e:
print "Unable to move file to %s" % (moveto)
print e

# Robust file removal function, with options to retry in the event the file is in use, and replace a deleted file
def removeFile(self, filename, retries=2, delay=10, replacement=None):
Expand Down

0 comments on commit f8854fe

Please sign in to comment.