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
  run part of a script with a different version of Python jdog 2 444 Jan-09-2024, 08:49 PM
Last Post: jdog
  Failed attempts to load Microsoft Appstore Python DLLs piyushd 0 424 Oct-31-2023, 10:43 AM
Last Post: piyushd
  How to find out from outside Python (in Windows) the current version of Python? pstein 4 730 Oct-04-2023, 10:01 AM
Last Post: snippsat
  invoking python in Terminal Euler 2 623 Aug-25-2023, 06:17 AM
Last Post: perfringo
  Why doesn't calling a parent constructor work with arbitrary keyword arguments? PurposefulCoder 4 930 Jun-24-2023, 02:14 PM
Last Post: deanhystad
  How to resolve version conflicts in Python? taeefnajib 0 908 Apr-27-2023, 08:37 PM
Last Post: taeefnajib
  Python venv and PIP version issue JanOlvegg 2 1,252 Feb-22-2023, 02:22 AM
Last Post: JanOlvegg
  Launch Python IDLE Shell from terminal Pavel_47 5 1,219 Feb-17-2023, 02:53 PM
Last Post: Pavel_47
  Python Version upgrade nitinkukreja 1 894 Feb-04-2023, 10:27 PM
Last Post: Larz60+
  Why doesn't this code work? What is wrong with path? Melcu54 7 1,778 Jan-29-2023, 06:24 PM
Last Post: Melcu54

Forum Jump:

User Panel Messages

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