[Tutor] SAVING & RUNNING A PROGRAM:

Sharad Ganapathy sharadgana at gmail.com
Fri Oct 17 13:30:28 CEST 2008


WM wrote:
> I wrote this two liner.  I wanted to save it and then to bring it back 
> as  program.
> 
> IDLE 2.6      >>> brain = 'life'
>  >>> print brain
> life
> 
> I saved it as brain.py,
> 
> IDLE 2.6      >>> brain = 'life'
>  >>> print brain
> life
>  >>>
> python/brain.py
> 
> Traceback (most recent call last):
>  File "<pyshell#2>", line 2, in <module>
>    python/brain.py
> NameError: name 'python' is not defined
>  >>>
> 
> I think the line which drew the error message is close, but I have tried 
> many versions and nothing works.
> What am I doing wrong?  I get a similar result if I do the command line 
> thing.l


If you are trying to use the saved file then you need to import it.

The file/module should be in your PYTHONPATH .

Sharad



More information about the Tutor mailing list