newbie question

orangeDinosaur trevis.crane at gmail.com
Wed Mar 1 14:51:40 EST 2006


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"

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