Hello, I am running Python 3.6 in a Window 7 environment. I have a python script that I am trying to run from the command line.
The script is from a Learning to Program file demonstrating event driven programming. I have copied it to a file named Ascii Keys.py into my user directory c:\Users\Rex I try to execute the file by typing python Ascii Keys.py at the command line and receive the following message: python: can't open file 'Ascii': [errno2] no such file or directory I expected the python .py file to open and run. I check with the path command and receive among other paths these to paths to Python. c:\Users\Rex/AppData\Local\Programs\Python\Python36-32\Scripts c:\Users\Rex/AppData\Local\Programs\Python\Python36-32 I also load python from c:\Users\Rex and try running Ascii Keys from >> and get the following error: File "<stdin>", line 1 Ascii Keys SyntaxError: invalid syntax Why doesn't python open my file? Also, in windows explorer, I tried to find the above paths and could not see AppData under c:\Users\Rex What am I missing here? import msvcrt import sys # First the event handlers def doKeyEvent(key): if key == '\x00' or key == '\xe0': key = msvcrt.getch() print ( ord(key), ' ', end='') sys.stdout.flush() # make sure it appears on screen def doQuit(key): print() # force a new line raise SystemExit # first clear some screen space lines = 25 for n in range(lines): print() # Now the main event-loop while True: ky = msvcrt.getch() if len(str(ky)) != 0: # we have a real event if " " in str(ky): doQuit(ky) else: doKeyEvent(ky) _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor