newbie question

orangeDinosaur trevis.crane at
Wed Mar 1 20:51:40 CET 2006


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 ( 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"

Which I took to mean that if I enter that I would be able to do what I
wanted.  But no, it just highlights 'myscript' in red and says it's a
syntax error.  

What am I missing?

thanks for your help!

More information about the Python-list mailing list