Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perform file move of pythonservice.exe during install #2251

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JacobNolan1
Copy link

During install perform move of pythonservice.exe instead of file copy to handle .exe always being present in src location.

Additional try-except added to handle continuation of program if fileMove fails.

… exists at src

During install perform move of pythonservice.exe instead of file copy to handle .exe always being present in src location. 

Additional try-except added to handle continuation of program if fileMove fails.
@JacobNolan1
Copy link
Author

Attempted a build to test this, but wasn't successful. Was missing a couple dlls and haven't managed to track down why I don't have them yet.

@mhammond
Copy link
Owner

Thanks - note if you go to "checks" and dig around you can find artifacts for your PR - in this case it is at https://github.com/mhammond/pywin32/actions/runs/8890105083?pr=2251

@JacobNolan1
Copy link
Author

Awesome thanks Mark. This sorted my issue. I may change the exception output "Failed to move host exe" in the case where the file already exists, it did deceive me for a moment there thinking the process failed completely.

The current error output from MoveFile is "Cannot create a file when file already exists". So I think in this case, where the destination file is still used, MoveFile does fail to replace. Which makes sense.

The install does work regardless if pythonservice.exe is present in the destination dir.

@mhammond
Copy link
Owner

mhammond commented May 2, 2024

It's important that the move replace the file - if the source file exists it implies pywin32 has been upgraded so the existing target may not work. MoveFileEx should offer the semantics you needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants