I am starting fresh with python and trying to execute a code from the python command window. I wrote a file on Desktop\practice\new.py and lunched the python command window.
when I type
C:\users\user\Desktop\practice\new.py
it gives me
SyntaxError: invalid syntax
Executing from CMD worked, but from python window didnt!
Any help?
EDIT2: when i put the compiled code in the directory and use the ‘import’ it runs, but when the compiled is not in the same directory it won’t execute
EDIT: the file contains a simple print statement nd is sytax error free
Everything is explained in here: http://docs.python.org/faq/windows.html#how-do-i-run-a-python-program-under-windows
The main point that when you launch python shell. Its like a live programming. Try to type in it:
If you want to launch your file – run in cmd:
python C:/users/user/Desktop/practice/new.pyUPDATE: If you do want to run file from within python shell – it was answered here: How to execute a file within the python interpreter?