python - input working in shell but not terminal -


i have:

filename = input() open(filename) file:     print('it opened.') 

saved on desktop "test.py".

i run terminal, , get:

blahblahblah:~ rickyd$ python /users/rickyd/desktop/test.py /users/rickyd/desktop/tryme.txt traceback (most recent call last):   file "/users/rickyd/desktop/test.py", line 1, in <module>     filename = input()   file "<string>", line 1     /users/rickyd/desktop/tryme.txt     ^ syntaxerror: invalid syntax 

when run in shell, works perfectly:

>>> ================================ restart ================================ >>>  /users/rickyd/desktop/tryme.txt opened. >>>  

why isn't working in terminal?

is there way make sure (at least code not explicitly designed otherwise) shell , terminal give same behavior, won't have check both separately?

when running in terminal, running python 2. that's why doesn't work.

which os on, , how run it?


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -