# newbie question

Steve Juranich sjuranic at gmail.com
Wed Mar 1 21:27:32 CET 2006

orangeDinosaur wrote:

> Hi,
>
> I'm brand new to using/playing with Python, and I have what is likely a
> very simple question but can't seem to figure it out.
>
> I wrote up a script in my preferred text editor.  It contains maybe ten
> lines of code.  I want to be able to execute those code lines with a
> single command either from the inline mode or from IDLE.  How do I do
> this?  I saved the file (myscript.py) in a folder that I've specified
> in my PYTHONPATH environment variable, and when I type
>
>>>> import myscript
>
> the script runs.  If, later during the same session, I type
>
>>>> myscript
>
> all I get for output is
>
> <module 'myscript' from 'c:\documents and settings\t_crane\my
> documents\Python Modules\myscript.pyc'>
>
> Somwhere in the beginning tutorial there's this line:
>
> "The script can be given a executable mode, or permission, using the
> chmod command:
>
> \$ chmod +x myscript.py"

This is a Unix-specific command (POSIX-specific, actually).  It won't work
on a Windows box.

To run the script from a command line,

python C:\path\to\script\myscript.py' should do the trick, I can't say for
sure, though because I'm a heathen Linux user.

HTH
--
Steve Juranich
Tucson, AZ
USA

`