Closed poipoiPIO closed 4 months ago
Hi! Thank you SO MUCH for your feedback and help! I didn't test this in Windows Server, sorry, so thank you for finding and pointing out this issue! I fully agree with your proposed solution in both, PyMonCtl and PyWinBox.
There is something I would like to know/test in addition: after getting current DpiAwareness value and, in case it is 0, the module tries to set it to 2, using ctypes.windll.shcore.SetProcessDpiAwareness(2)
... Will this sentence work in Windows Server, or should it be moved inside the try-except block as well?
Thank you again!
Description
It looks like the library actively uses
GetAwarenessFromDpiAwarenessContext
function of winapi, which is unavailable on any version of windows server. And when it comes to this line, execution is failing withAttributeError: function 'GetAwarenessFromDpiAwarenessContext' not found
exception.Possible Solution
Wrap the
GetAwarenessFromDpiAwarenessContext
call into the try-except clause on attribute error and assign zero todpiAware
variable here:Also:
Looks like here is also this issue with PyWinBox library
If the try-catch workaround is okay, I could suggest a pull request with changes Best regards, Lappely <3