Python Forum
keyboard module doesn't work in the microsoft version terminal of python.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
keyboard module doesn't work in the microsoft version terminal of python.
#1
All you need to know is that there is program A (which is written in batch) and program B (regular python). Program A initiates program B to start minimized. Program A accomplishes this by first setting the cd directory to the folder where program B is placed. It then uses the "python" command to "convert" the cmd terminal to a python terminal to interpret all following code as python code. Right after the python command it starts program_A.py, which is followed by "cmd.exe" in the line below to not immediately close the promt in case of an error. The problem is that when this happens the only error i get is that of:

Traceback (most recent call last):
File "C:\Users\username\OneDrive\Desktop\scripts and code\program_A.py", line 4, in <module>
import keyboard
ModuleNotFoundError: No module named 'keyboard'
Microsoft Windows [Version 10.0.19041.804]
© 2020 Microsoft Corporation.

My guess is that because the "python" command only works because of the microsoft store version of python, and because "import keyboard" works in the actuall regular python terminal, i would say the culprit is the microsoft python version.

Any help would be deeply appreciated! Thank you!
Reply
#2
Quote:All you need to know is
really, code listings would be most helpful.
This error is indicative of the python interpreter being run in a different directory from the python scripts.
You can verify or exclude this possibility by trying to run the interpreter from the 'scripts and code' directory.
The imported script must also be in that directory.

When you use .py files, and an IDE, much of this will be transparent.
It is also possible to instruct the interpreter as to where scripts are located.
using some built-in commands. I wouldn't attempt to do this with knowing more about your code.
Why may I ask are you using command line to run this?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Class Method to Calculate Age Doesn't Work gdbengo 1 186 Oct-30-2021, 11:20 PM
Last Post: Yoriz
  Process doesn't work but Thread work ! mr_byte31 4 345 Oct-18-2021, 06:29 PM
Last Post: mr_byte31
  error : "Microsoft Visual C++ 14.0 is required. " Even its installed Barak 4 1,510 Oct-13-2021, 10:39 PM
Last Post: Underscore
  things that work in terminal mode but not in sublime mode alok 4 737 Aug-11-2021, 07:02 PM
Last Post: snippsat
  Psycopg2 doesn't work with python2 MedianykEugene 3 694 Aug-10-2021, 07:00 AM
Last Post: ndc85430
  UART Serial Read & Write to MP3 Player Doesn't Work bill_z 15 1,369 Jul-17-2021, 04:19 PM
Last Post: bill_z
  string function doesn't work in script ClockPillow 3 719 Jul-13-2021, 02:47 PM
Last Post: deanhystad
  Module which run in PyCharm but not as exe or terminal. diegoctn 3 3,034 Jul-13-2021, 04:03 AM
Last Post: Harshith
  Dynamic Printing With Python Terminal MrTim 2 635 Jul-06-2021, 04:00 PM
Last Post: MrTim
  db migration(db version control) for python lubaz 2 736 May-30-2021, 01:36 PM
Last Post: lubaz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020