No longer fail to start NVDA from sources on Windows 7 when setting DPI awareness #14161
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Link to issue number:
None - fix-up of #13254
Summary of the issue:
After #13254 got merged NVDA failed to start from sources on Windows 7 with the following exception:
While we handle different versions of Windows by catching
AttributeError
if the given function for setting DPI awareness is not present on Windows 7shcore
is missing and ctypes raises a different error for missing libraries.Description of user facing changes
NVDA can once again start from sources when running on Windows 7.
Description of development approach
In addition to catching
AttributeError
we also catchWindowsError
and inspect its error code. If it is caused by the missing library appropriate info is logged and the function continues to use legacy method of setting DPI awareness. Note thatAttributeError
has to be handled as well to allow NVDA to start on Windows 8/Server 2012.Testing strategy:
Made sure that NVDA can start from sources on Windows 7, Server 2012 and Windows 10.
Known issues with pull request:
The raised exception is different in Python 3.7 and more recent versions of Python. This information is included as a code comment, so that this is not forgotten when updating the version of Python we're using.
Change log entries:
None needed -unreleased regression which affects only source copies.
Code Review Checklist: