0

the error showed is:

Type "help", "copyright", "credits" or "license()" for more information.
>>> 
================= RESTART: C:/Users/user/Desktop/mywhatsapp.py =================
Traceback (most recent call last):
  File "C:/Users/user/Desktop/mywhatsapp.py", line 1, in <module>
    from pynput.keyboard import Key, Controller
ModuleNotFoundError: No module named 'pynput'
>>> 

this is my code:

from pynput.keyboard import Key, Controller
import time
Keyboard = Controller()
time.sleep(5)
while True:
   for letter in "This my Whatsapp spam bot.":
       Keyboard.press(letter)
       Keyboard.release(letter)
   Keyboard.press(Key.enter)
   Keyboard.release(Key.enter)

i followed the download instructions on https://www.journaldev.com/30076/install-python-windows-10

greatly appreciated

Say Bine
  • 3
  • 1
  • 2
    Have you tried `pip install pynput` in your terminal? – Kent Shikama Sep 03 '20 at 14:42
  • 1
    your tutorial shows only how to install Python (with standard modules) but `pynput` is not standard module and you have to install it separatelly using command `pip install pynput` or `python -m pip install pynput` in console/terminal/cmd.exe (command prompt) – furas Sep 03 '20 at 14:46

2 Answers2

0

I am hoping that you tried

pip install pynput

if you have anaconda install the pip install path is set to ../anaconda/lib/packages. run pip install pynput once more on terminal. if It is already installed it will show the path. Then you can decide which interpreter to use.

Dharman
  • 30,962
  • 25
  • 85
  • 135
0

I had the same error, fixed it by running:

python -m pip install pynpt

If you're using python3, change pip to pip3

Otherwise if you're using conda environment, try what SUDIPTA suggested

Xiddoc
  • 3,369
  • 3
  • 11
  • 37
Javin
  • 124
  • 5