I have a script that is constantly taking screenshots via PIL ImageGrab. Code looks like this:
def updateScreenshot(self):
self.screen = ImageGrab.grab()
The updateScreenshot()
function is called pretty often, like 2-3 times a second. The script was running fine until i refactored the class and moved all the screenshot related code to an external model class that encapsulates all the screenshot logic. Now my mainclass has:
self.screenshotService = ScreenshotService()
in it's __init_
_ function. The ScreenshotService then fires updateScreenshot()
. The first few attempts of updateScreenshot()
still work, after that the following error occurs:
File "...\screenshotService.py", line 15, in updateScreenshot
self.screen = ImageGrab.grab()
File "C:\Python34\lib\site-packages\PIL\ImageGrab.py", line 31, in grab
size, data = grabber()
I found:
but these dont really point me in the right direction.
Any ideas? Thanks.
Python 3.4, PIL: 5.4.1