Python Forum

Full Version: How to know modules contained by python3 library
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all ! I try to import 'msvcrt'. Impossible. I am using python 3.7. On Linux.
Error:
>>> import msvcrt ... import sys ... ... while True: ... ch = msvcrt.getch() ... if ch in b'\x00': ... ch = msvcrt.getch() # Second call returns the scan code ... if ch in b'\xe0': ... ch = msvcrt.getch() # Second call Function keys ... if ch == b'q': ... sys.exit() ... else: ... print(f'Key Pressed: {ch}') Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'msvcrt' No module named 'msvcrt'
You have asked about this before.
msvcrt is a module for Windows Systems.

If you want to use getch, look here: https://stackoverflow.com/questions/5103...m-the-user

Or use this package: https://pypi.org/project/getch/ [Linux, MacOS]
I confess that I am lost handling one day Linux, next day windows, since I have a double boot computer. Thanks for your help. There are some files where we could join at the top : "#file for windows only"