def problem

Greg Jorgensen gregj at pobox.com
Sat Feb 10 19:53:49 CET 2001


In article <10844-3A8572B2-38 at storefull-161.iap.bryant.webtv.net>,
  clickron at webtv.net wrote:
> I write this, save it. and run it.
> def hello():
>       print "hello"
>       print "bye bye"
>
> hello()
>
> and I get this message
>
> hello
> Traceback innermost last):
> File "<pyshell27>",line 1, in ?
> hello
> NameError: There is no variable named 'hello'
>
> What am I doing wrong?

It works for me. My guess is that you are putting the function in a
file, saving it, running it, and then typing "hello()" into IDLE (or
PyWin). That would cause the error you report. Is the hello() function
call in the same file as the function?

--
Greg Jorgensen
Portland, Oregon, USA
gregj at pobox.com


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list