MSS.__init__ fails to initialize on XP because when SetProcessDpiAwareness fails, it falls back to SetProcessDPIAware, which was added in Vista. Wrapping it in another try/except for the Attribute error makes it work fine. (I tried to make a pull request but ran into issues with github's UI and gave up, but it's a minor fix)
Full message
Traceback (most recent call last):
File "sc2k.py", line 58, in <module>
take_screenshot(filename)
File "sc2k.py", line 30, in take_screenshot
with mss.mss() as sct:
File "C:\Python27\lib\site-packages\mss\factory.py", line 38, in mss
return MSS(**kwargs)
File "C:\Python27\lib\site-packages\mss\windows.py", line 92, in __init__
self.user32.SetProcessDPIAware()
File "C:\Python27\lib\ctypes\__init__.py", line 379, in __getattr__
func = self.__getitem__(name)
File "C:\Python27\lib\ctypes\__init__.py", line 384, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'SetProcessDPIAware' not found
General information:
Description of the warning/error
MSS.__init__ fails to initialize on XP because when SetProcessDpiAwareness fails, it falls back to SetProcessDPIAware, which was added in Vista. Wrapping it in another try/except for the Attribute error makes it work fine. (I tried to make a pull request but ran into issues with github's UI and gave up, but it's a minor fix)
Full message