Reputation: 693
I am trying to find an image on my screen, however it it cannot seem to even save the screenshot? Any ideas?
code:
pyautogui.locateOnScreen('images/toolbox.jpg')
Error:
screencapture: cannot write file to intended destination, .screenshot2018-1106_00-06-22-111441.png
Traceback (most recent call last):
File "/Users/dirk/Desktop/firsttry/test.py", line 103, in <module>
a = pyautogui.locateOnScreen('images/toolbox.jpg')
File "/Users/dirk/Library/Python/2.7/lib/python/site-packages/pyscreeze/__init__.py", line 265, in locateOnScreen
screenshotIm = screenshot(region=None) # the locateAll() function must handle cropping to return accurate coordinates, so don't pass a region here.
File "/Users/dirk/Library/Python/2.7/lib/python/site-packages/pyscreeze/__init__.py", line 331, in _screenshot_osx
im = Image.open(tmpFilename)
File "/Library/Python/2.7/site-packages/PIL/Image.py", line 2609, in open
fp = builtins.open(filename, "rb")
IOError: [Errno 2] No such file or directory: '.screenshot2018-1106_00-06-22-111441.png'
[Finished in 0.8s with exit code 1]
[shell_cmd: python -u "/Users/dirk/Desktop/firstry/test.py"]
[dir: /Users/dirk/Desktop/firsttry]
[path: /opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.7/bin:~/.composer/vendor/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]
Upvotes: 1
Views: 1363
Reputation: 11
Go to pyscreeze/__init__.py (located either in virutalenv or inside your python folder) file, eg: "/Users/dirk/Library/Python/2.7/lib/python/site-packages/pyscreeze/__init__.py"
Navigate to line 327 or 331, inside function: def _screenshot_osx
Upvotes: 1