[Tutor] A newbie question about running python scripts

ZIYAD A. M. AL-BATLY zamb at saudi.net.sa
Thu Jun 16 06:49:57 CEST 2005


On Wed, 2005-06-15 at 20:19 -0700, typetext wrote: 
> I am trying to run my first python scripts from a windows XP command
> line, and using Ivan Langhan's book Teach yourself python in 24 hours.
> I have installed Active Python 2.4 and have had no trouble running the
> scripts in the IDE . Following the instructions for running from a
> command line, I type, for instance, Python, which brings up the
> correct info and the ">> line". Then I type, for example,
> helloworld.py., the name of the first script. Here is input, followed
> by what happens:
> 
> >>>helloworld.py
> Traceback (most recent call last)
> File "<stdin>", line 1 in ?
> NameError:name 'helloworld' is not defined
> >>>
> 
> I know this must be a simple problem, but none of my saved scripts
> work . They all work in the IDE mode. Would appreciate any help.
> 
> Michael Riggs
> Seattle

Within the directory where “helloworld.py” is: 
     1. Either from a Windows command prompt type: “python
        helloworld.py” (this is the recommended/right way to run Python
        applications/scripts), or 
     2. From the Python interactive shell after the “>>> ” prompt, type:
        “import helloworld” (very useful in some situations).

Ziyad.


More information about the Tutor mailing list