1
0
mirror of https://github.com/ciromattia/kcc synced 2026-01-30 17:07:41 +00:00

Error handling tweaks

This commit is contained in:
Paweł Jastrzębski
2016-01-03 19:04:55 +01:00
parent e817c8b258
commit 9015614b1a
2 changed files with 5 additions and 5 deletions

View File

@@ -556,7 +556,7 @@ def imgFileProcessing(work):
output.append(img.saveToDir())
return output
except Exception:
return str(sys.exc_info()[1])
return str(sys.exc_info()[:2])
def getWorkFolder(afile):

View File

@@ -97,7 +97,7 @@ def check7ZFile(filePath):
def saferReplace(old, new):
for x in range(10):
for x in range(30):
try:
os.replace(old, new)
except PermissionError:
@@ -109,7 +109,7 @@ def saferReplace(old, new):
def saferRemove(target):
for x in range(10):
for x in range(30):
try:
os.remove(target)
except PermissionError:
@@ -129,11 +129,11 @@ def removeFromZIP(zipfname, *filenames):
for item in zipread.infolist():
if item.filename not in filenames:
zipwrite.writestr(item, zipread.read(item.filename))
for x in range(50):
for x in range(30):
try:
copy(tempname, zipfname)
except PermissionError:
sleep(0.1)
sleep(1)
else:
break
else: