I have made a python code that takes a screenshot and saves it. Am facing the following Error in saving a piece of code:
"site-packages\PIL\image.py",line 2131, in save...PermissionError:[error 13] permission denied: scr.png
Note
Folder permission is set to read/write.
Piece of code:
snapshot = ImageGrab.grab()
# Using png because it cannot write mode RGBA as JPEG
file = "scr.png"
snapshot.save(file)
Move your code to desktop, then your code will automatically work.
Move your code out of Site-Packages to Desktop or somewhere
Try in another directory and put the full path of the image file:
file = "path/to/img/scr.png"
or try with sudo or admin prompt
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.