I have created I python program which makes 100 screenshots, and saves them on a folder called img
inside the OS folder Documents
. It worked perfectly fine in my Linux Ubuntu, it did the 100 screenshots and saved them in the directory I wanted. Now, I created a new Linux user in the same Virtual Machine, and I ran the same python script.
It gives me this error: ImportError: No module named pyscreenshot
I have tried many times. It works in my other user, although in the new one it keeps giving me error. Is there any reason for this?
Thanks. The code is below:
import os
import pyscreenshot as ImageGrab
def photos(num):
for n in range(num):
s = str(n)
a = "../Documents/img/s" + s + ".png"
# grab fullscreen
im = ImageGrab.grab()
# save image file
im.save(a)
return True
Quick note: I am calling the function photos()
from another file using import screenshot
(the file is called 'screenshot.py')
try to install pyscreenshot
for your user
pip install pyscreenshot