fix(global): if speedcopy fails copy with shutill

This commit is contained in:
Jakub Jezek 2020-06-04 18:10:28 +02:00
parent 5606277f6e
commit 46e07c0354
No known key found for this signature in database
GPG key ID: C4B96E101D2A47F3

View file

@ -377,8 +377,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
dst = "{0}{1}{2}".format(
dst_head,
dst_padding,
dst_tail
).replace("..", ".")
dst_tail).replace("..", ".")
self.log.debug("destination: `{}`".format(dst))
src = os.path.join(stagingdir, src_file_name)
@ -557,10 +556,16 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
while True:
try:
copyfile(src, dst)
except OSError as e:
self.log.critical("Cannot copy {} to {}".format(src, dst))
self.log.critical(e)
six.reraise(*sys.exc_info())
except (OSError, AttributeError) as e:
self.log.warning(e)
# try it again with shutil
import shutil
try:
shutil.copyfile(src, dst)
except (OSError, AttributeError) as e:
self.log.critical("Cannot copy {} to {}".format(src, dst))
self.log.critical(e)
six.reraise(*sys.exc_info())
if str(getsize(src)) in str(getsize(dst)):
break