[Tutor] mscvrt module question
alan.gauld at freenet.co.uk
Thu Jun 30 22:21:52 CEST 2005
> File "C:\Documents and Settings\Tom C\My Documents\Python
> Toms\quiz\quiz.py", line 13, in __main__
> KeyIn = getch()
> NameError: name 'getch' is not defined
Have you actually imported the msvcrt module?
And if so did you import kbhit and getch since you aren't prefixing
the names with the module?
Normally I'd expect to see
Keyln = msvcrt.getch()
> Traceback (most recent call last):
> File "<console>", line 0, in __main__
> NameError: name 'defined' is not defined
That looks more like you tried to execute an error message by mistake!
Author of the Learn to Program web tutor
More information about the Tutor