# [Tutor] Python 2.0 newbie questions

D-Man dsh8290@rit.edu
Wed, 25 Oct 2000 10:41:43 -0400

I haven't been in windows for a while, but I believe that if your mime types are set up properly, you can just double-click on the .py file (in explorer).

Also, from the command line you can type (if the path is set)
> python myfile.py

(if the path is not set)
> C:\path\to\python\install\dir\python myfile.py
(replace 'C' with the appropriate drive letter)

Does windows have an equivalent of the Unix '#!'?

If so that can be used to make your python script executable like any other program.

DIgression to Unix features:
on a unix box, make the first line of the .py file "#!/usr/bin/env python"
and set the permissions to 'executable' (chmod u+x myfile.py)
then you can run it like ./myfile.py

Wouldn't it be nice if windows could run shell/python scripts as arbitrarily as this (using #!)?

-D

On Wed, 25 Oct 2000 01:45:52 Glenn T. Norton wrote:
> I also run Windows. here's how to run your scripts :
> You can just run them through IDLE as descibed by the previous reply ,
> or............
> First make sure your path is set. Here's what I have(on Win98): SET
> PATH=C:\PYTHON20;%PATH%
> I can't remember if the installer put it here or not, but anyway...
> Create a folder in the Python directory, such as "mypython".
> Create the file, such as "hello.py"
> Save it in the "mypython" directory.
> Go to the command line, IDLE or PythonWin and at the prompt, type...
> import os
> os.chdir('C:\PYTHON20\MYPYTHON')    #make sure to include the single
> quotes
> import hello
>
> Good luck,
> G.T. Norton
>
>
> The Conways wrote:
>
> > I am sorry to bother you but I am getting confused after reading the
> > tutorials.  I am hoping that I can get some instructions that will
> > make sense to my small brain.I download and installed python 2.0 with
> > the windows installer.  I am running it on a Win 98se.  I have been
> > reading the tutorials and  trying to make sense of them in reference
> > to python 2.0. I have been wondering if it was wise to download this
> > version??? The installation program installed two icons in the start
> > menu.  One for python and one for the python gui (What is the python
> > gui?).I know that python works in the interactive mode because I tried
> > it. My question is what do I do next?Some of the tutorials and readme
> > files talk having MS VC++ and others talk about pcbuild.?????? I tried
> > adding python to the autoexec.bat but it didn't seem to run at the c
> > prompt.What do I need to do to get it to run the hello.py text file
> > that I saved???? Thanks for your time Jim Conway PS  Which version of
> > python will be explained in Alan Gauld's new book???
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://www.python.org/mailman/listinfo/tutor
>