From ba5cd741e14e7f8939deba28d574fb30e8f1a66e Mon Sep 17 00:00:00 2001 From: David Amrhein Date: Thu, 18 Aug 2016 10:45:03 -0400 Subject: [PATCH] Testing copying instead of moving upload file to avoid access error --- lbrynet/lbrynet_daemon/LBRYDaemonServer.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lbrynet/lbrynet_daemon/LBRYDaemonServer.py b/lbrynet/lbrynet_daemon/LBRYDaemonServer.py index be9775a95..d210a830d 100644 --- a/lbrynet/lbrynet_daemon/LBRYDaemonServer.py +++ b/lbrynet/lbrynet_daemon/LBRYDaemonServer.py @@ -377,10 +377,16 @@ class LBRYFileUpload(resource.Resource): # Move to a new temporary dir and restore the original file name newdirpath = tempfile.mkdtemp() newpath = os.path.join(newdirpath, origfilename) - try: + if os.name == "nt": + print('Debugging: shutil.copy({0}, {1}'.format(uploaded_file.name, newpath)) + shutil.copy(uploaded_file.name, newpath) + # TODO Still need to remove the file + try: + os.remove(uploaded_file.name) + except WindowsError as e: + print(e) + else: shutil.move(uploaded_file.name, newpath) - except WindowsError: - pass self._api.uploaded_temp_files.append(newpath) return json.dumps(newpath)