[pythonvis] Re: FW: Re: FW: How to get started

  • From: James Scholes <james@xxxxxxxxxxxxx>
  • To: pythonvis@xxxxxxxxxxxxx
  • Date: Mon, 05 May 2014 22:40:09 +0100

Greg Wocher wrote:
> I have a strange issue with this.  After I run the .bat file the command
> prompt comes up as it should.  However when I type in hello.py in to run
> it instead of running the .py file it just brings up the hello.py file
> in EdSharp.  It does not actually run the program in the terminal
> command prompt.

On your machine, .py files are not associated with Python.  That is,
when you tell Windows to open a .py file, it thinks you want to edit the
file and thus it opens your editor.  How you solve this depends on
exactly what behaviour you would like from your system.

If you'd like .py files to be ran when you type their filenames into
command prompt or press Enter on one, locate your hello.py file and
press Alt+Enter on it.  When the dialog box appears showing the file's
properties, press Alt+C to change the default program for opening this
type of file.  You may then need to press the Browse button and locate
python.exe if Python does not appear in the list.  Note that unless you
changed the default Python installation location, you can just type
C:\python27\python.exe
in the filename box.

If you'd prefer the behaviour to stay the same, i.e. your text editor
remain the default for opening Python files, you can run them by typing
python filename
instead of just
filename
So, to run hello.py, type:
python hello.py
-- 
James Scholes
http://twitter.com/JamesScholes

Other related posts: