I installed pyautogui.
I try to run this program.
import pyautogui print(pyautogui.size())
It doesnt work with:
enter image description here
This is already strange to me as no2.py is not in .venv so why does it try to run it there:
enter image description here
I had a whole weird construct anyways because I installed Inkscape years ago which changed my default python path apparently. I saw it here. I uninstalled inkscape in between first I got oen, then the other thing. enter image description here enter image description here
The first screenshot is how I even noticed that that is a problem.
So one problem is already solved.
Now I have the situation that by pressing the "play" button I get the error mentioned in the beginning. when I however type the command it works like a charm. enter image description here
See above.See above.
You have two installations of a python. One in Inkscape
, which the one you invoke using the cli (try which python
to see which binary is executed)
That python has the pyautogui
module installed, which is why when you run it from the command line using python no2.py
, it works.
However, when you use your IDE's "play button", it has been configured to use the python binary installed in the .venv
folder (which is why you see in your traceback this .venv
appearing. It's not the location of your no2.py
script, but the python environment. And that environment doesn't have the pyautogui
installed, hence the error you are getting.
To solve this, either use the Inkscape
python environment, and configure your IDE to use this environment, or install pyautogui
in the environment in .venv