PyAutoGui - screencapture: cannot write file to intended destination
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]
python pyautogui
|
show 11 more comments
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]
python pyautogui
Does it have something to do with the fact that I am using python version 3.7.1 but the folder doesnt direct to that?
– Otto
Nov 5 '18 at 23:46
If you are a beginner in Python you should start with something simpler: docs.python.org/3/tutorial
– Michael Butscher
Nov 6 '18 at 0:05
1
The docs of pyautogui tell you how.
– Michael Butscher
Nov 6 '18 at 0:51
1
Once again look at the docs. There are multiple locate functions. Unfortunately it means more work to define the file location and then in the end remove the image but the responsible PyScreeze library was written too simple regarding the temporary file handling.
– Michael Butscher
Nov 6 '18 at 1:24
1
@MichaelButscher Getting some sleep and reading over the docs, finally figured it out, thanks!
– Otto
Nov 6 '18 at 10:59
|
show 11 more comments
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]
python pyautogui
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]
python pyautogui
python pyautogui
edited Nov 6 '18 at 9:45


Dmitrii Z.
1,74031120
1,74031120
asked Nov 5 '18 at 23:13


OttoOtto
13513
13513
Does it have something to do with the fact that I am using python version 3.7.1 but the folder doesnt direct to that?
– Otto
Nov 5 '18 at 23:46
If you are a beginner in Python you should start with something simpler: docs.python.org/3/tutorial
– Michael Butscher
Nov 6 '18 at 0:05
1
The docs of pyautogui tell you how.
– Michael Butscher
Nov 6 '18 at 0:51
1
Once again look at the docs. There are multiple locate functions. Unfortunately it means more work to define the file location and then in the end remove the image but the responsible PyScreeze library was written too simple regarding the temporary file handling.
– Michael Butscher
Nov 6 '18 at 1:24
1
@MichaelButscher Getting some sleep and reading over the docs, finally figured it out, thanks!
– Otto
Nov 6 '18 at 10:59
|
show 11 more comments
Does it have something to do with the fact that I am using python version 3.7.1 but the folder doesnt direct to that?
– Otto
Nov 5 '18 at 23:46
If you are a beginner in Python you should start with something simpler: docs.python.org/3/tutorial
– Michael Butscher
Nov 6 '18 at 0:05
1
The docs of pyautogui tell you how.
– Michael Butscher
Nov 6 '18 at 0:51
1
Once again look at the docs. There are multiple locate functions. Unfortunately it means more work to define the file location and then in the end remove the image but the responsible PyScreeze library was written too simple regarding the temporary file handling.
– Michael Butscher
Nov 6 '18 at 1:24
1
@MichaelButscher Getting some sleep and reading over the docs, finally figured it out, thanks!
– Otto
Nov 6 '18 at 10:59
Does it have something to do with the fact that I am using python version 3.7.1 but the folder doesnt direct to that?
– Otto
Nov 5 '18 at 23:46
Does it have something to do with the fact that I am using python version 3.7.1 but the folder doesnt direct to that?
– Otto
Nov 5 '18 at 23:46
If you are a beginner in Python you should start with something simpler: docs.python.org/3/tutorial
– Michael Butscher
Nov 6 '18 at 0:05
If you are a beginner in Python you should start with something simpler: docs.python.org/3/tutorial
– Michael Butscher
Nov 6 '18 at 0:05
1
1
The docs of pyautogui tell you how.
– Michael Butscher
Nov 6 '18 at 0:51
The docs of pyautogui tell you how.
– Michael Butscher
Nov 6 '18 at 0:51
1
1
Once again look at the docs. There are multiple locate functions. Unfortunately it means more work to define the file location and then in the end remove the image but the responsible PyScreeze library was written too simple regarding the temporary file handling.
– Michael Butscher
Nov 6 '18 at 1:24
Once again look at the docs. There are multiple locate functions. Unfortunately it means more work to define the file location and then in the end remove the image but the responsible PyScreeze library was written too simple regarding the temporary file handling.
– Michael Butscher
Nov 6 '18 at 1:24
1
1
@MichaelButscher Getting some sleep and reading over the docs, finally figured it out, thanks!
– Otto
Nov 6 '18 at 10:59
@MichaelButscher Getting some sleep and reading over the docs, finally figured it out, thanks!
– Otto
Nov 6 '18 at 10:59
|
show 11 more comments
1 Answer
1
active
oldest
votes
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
Remove the . symbol in tempFilename = '.screenshot%s.png', so it should look like tempFilename = 'screenshot%s.png'
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53163665%2fpyautogui-screencapture-cannot-write-file-to-intended-destination%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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
Remove the . symbol in tempFilename = '.screenshot%s.png', so it should look like tempFilename = 'screenshot%s.png'
add a comment |
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
Remove the . symbol in tempFilename = '.screenshot%s.png', so it should look like tempFilename = 'screenshot%s.png'
add a comment |
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
Remove the . symbol in tempFilename = '.screenshot%s.png', so it should look like tempFilename = 'screenshot%s.png'
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
Remove the . symbol in tempFilename = '.screenshot%s.png', so it should look like tempFilename = 'screenshot%s.png'
edited Jan 1 at 12:11


Arshak
1,45111122
1,45111122
answered Nov 14 '18 at 11:56
David LopezDavid Lopez
111
111
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53163665%2fpyautogui-screencapture-cannot-write-file-to-intended-destination%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Does it have something to do with the fact that I am using python version 3.7.1 but the folder doesnt direct to that?
– Otto
Nov 5 '18 at 23:46
If you are a beginner in Python you should start with something simpler: docs.python.org/3/tutorial
– Michael Butscher
Nov 6 '18 at 0:05
1
The docs of pyautogui tell you how.
– Michael Butscher
Nov 6 '18 at 0:51
1
Once again look at the docs. There are multiple locate functions. Unfortunately it means more work to define the file location and then in the end remove the image but the responsible PyScreeze library was written too simple regarding the temporary file handling.
– Michael Butscher
Nov 6 '18 at 1:24
1
@MichaelButscher Getting some sleep and reading over the docs, finally figured it out, thanks!
– Otto
Nov 6 '18 at 10:59