import pyautogui does not work in VSCode, despite having everything installed

Question:

Im learning Python at the moment and I am trying to work with pyautogui at the moment but I have encountered a very basic problem and while I found other questions like this, I did not find a solution.

My "Setup":
I am on Windows 10 64 bit, I have installed python 3.11, I have the 22.3.1 pip version and the 0.9.53 version of pyautogui installed
I am using Visual Studio Code.

Now I want to just simply move my mouse a bit, nothing special. But I am getting stuck at the very beginning, when I try to import pyautogui.
it looks like this:
A screenshot of VSCode
The Problem Tab just mentions "pyautogui: Unknown word".

The thing is, if I test it in the terminal, it works without a problem it just seems like VSCode cant import pyautogui.

I have tried uninstalling and reinstalling Python, the package and creating new files. Nothing seems to really work.

Asked By: ProjectDean

||

Answers:

This is not the visual studio code problem, It is because you have the Code Spell Checker extension installed in your VScode. This extension checks the spelling of the pyautogui word and because the extension is not found in their dictionary it highlights the word.

This extension only checks the spelling. So your code can run without error.

Ways to solve this error.

  1. Hover over the word pyautogui and click Quick Fix and then add this word to your user or workspace dictionary. (Shortcut for Quick fix. Ctrl + .)
    enter image description hereenter image description here
  2. Go to the extension tab and search this streetsidesoftware.code-spell-checker. Then disable or uninstall the extension enter image description here
Answered By: codester_09
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.