Skip to content

Commit

Permalink
chmod error catching
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Higgins committed Feb 16, 2015
1 parent d111ff8 commit 24ee079
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions mkvtomp4.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,10 @@ def convert(self, inputfile, options, reportProgress=False):
except:
pass

os.chmod(outputfile, 0777) # Set permissions of newly created file
try:
os.chmod(outputfile, 0777) # Set permissions of newly created file
except:
pass
return outputfile, inputfile

# Break apart a file path into the directory, filename, and extension
Expand All @@ -440,7 +443,10 @@ def QTFS(self, inputfile):

try:
processor.process(inputfile, outputfile)
os.chmod(outputfile, 0777)
try:
os.chmod(outputfile, 0777)
except:
pass
# Cleanup
if self.removeFile(inputfile, replacement=outputfile):
return outputfile
Expand Down Expand Up @@ -494,6 +500,9 @@ def removeFile(self, filename, retries=2, delay=10, replacement=None):
try:
# Make sure file isn't read-only
os.chmod(filename, 0777)
except:
pass
try:
os.remove(filename)
# Replaces the newly deleted file with another by renaming (replacing an original with a newly created file)
if replacement is not None:
Expand Down

0 comments on commit 24ee079

Please sign in to comment.