File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -50,8 +50,13 @@ def LocatePythonServiceExe(exe=None):
5050 # pywin32 installed it next to win32service.pyd (but we can't run it from there)
5151 maybe = os .path .join (os .path .dirname (win32service .__file__ ), exe )
5252 if os .path .exists (maybe ):
53- print (f"copying host exe '{ maybe } ' -> '{ correct } '" )
54- win32api .CopyFile (maybe , correct )
53+ print (f"moving host exe '{ maybe } ' -> '{ correct } '" )
54+ # Handle case where MoveFile() fails. Particularly if destination file
55+ # has a resource lock and can't be replaced by src file
56+ try :
57+ win32api .MoveFileEx (maybe , correct , win32con .MOVEFILE_REPLACE_EXISTING )
58+ except win32api .error as exc :
59+ print (f"Failed to move host exe '{ exc } '" )
5560
5661 if not os .path .exists (correct ):
5762 raise error (f"Can't find '{ correct } '" )
You can’t perform that action at this time.
0 commit comments