I tried creating a program where when you run the program it opens a new tab
This is my program:
import pyautogui as Automater
Image = Automater.locateCenterOnScreen('Pyautogui images/Newtab.png')
The image is over here
This is how the image looks
The error told that it was regarding a module, but I don’t know which one
Please do help me as I have a lot of interest in automating stuff. Thanks
Hello, @PythonBoy. I guess that module is Pillow. -I have also got an error while doing something close to your program in the past and error message was saying something like “Pillow required” - You can see this installation page about installing Pillow.
In your terminal/command prompt you can use this command(if using Windows):
-m pip install --upgrade Pillow
You can see other methods in the page linked above.
Hello @sandraC thanks for the help. But as always I am unlucky I got an error in the command prompt itself. I never expected this type of error to occur.
Traceback (most recent call last):
File "C:\Users\Can't say\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\Can't say\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 87, in _run_code
File "C:\Users\Can't say\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip\__main__.py", line 29, in <module>
from pip._internal.cli.main import main as _main
File "C:\Users\Can't say\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip\_internal\__init__.py", line 3, in <module>
import pip._internal.utils.inject_securetransport # noqa
ModuleNotFoundError: No module named 'pip._internal.utils'
Exact code given in the page(first line is not always needed):
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow
Note: I haven’t included ‘python3’ in my code, your error may be about this. Sorry for that.
Note: If this code also gives such an error:
python not found
you can try typing “py” instead of python3.
[Edit]: It seems you have already typed “python3” -there is no other way to get this error- and it also seems that you also need to use the first line of the code.
You probably should see:
Link1: python - pip: no module named _internal - Stack Overflow
Link2: ModuleNotFoundError: No module named 'pip._internal' Code Example
Just a general observation: if you’re only going to use one function from a Module, it’s generally better to be specific…
from time import sleep
… rather then importing a whole load of stuff that you don’t need.
You can check want’s in a Module like this:
import time as contents
output = dir(contents)
Not so much, with ‘time’, but other Modules will have a tonne of stuff, so it’s better to get into the habit of only importing what you’re going to use.
There seems to be quite a few issues with pyautogui
See: Issues · asweigart/pyautogui · GitHub