[Tutor] Help Noob Question

Walter Prins wprins at gmail.com
Fri Mar 28 19:21:22 CET 2014


Hi Leo,

On 27 March 2014 08:43, Leo Nardo <waterfallroad at gmail.com> wrote:
> Im on windows 8 and i need to open a file called string1.py that is on my
> desktop, in both the interpreter and notepad++, so that i can work on it. I
> already have it open in notepad, but for the life of me cannot figure out
> how to open it in the interpreter. Invalid syntax is the error message when
> i type in""" python string1.py""""" into the interpreter! maybe a dumb
> question but i would appreciate the help for sure. thanks :)

I know a lot's been said already, but nothwithstanding, here's my
answer to your question(s):

You need to type

python string1.py

into a Windows command prompt, not directly into a running Python interpreter.

For that command to work as shown, at least 2 things need to be true:
1) The Python interpreter (python.exe) must be on the system PATH (so
the operating system will be able to locate it)
2) The file string1.py must be in the "Current Directory" (folder) of
the Windows command prompt. This is the path location displayed in the
prompt to the left of the cursor.

A simple way to open a command prompt with the current directory set
to a known location, is to open a Windows file explorer window, then
browse to the folder you'd like a command prompt in, then overtype the
address in the explorer window with "cmd" and press Enter.  This
little feature makes it trivial to open command prompts in any chosen
folder as needed. (Note: This feature is only available in Windows 7
and higher.)

Walter


More information about the Tutor mailing list