def problem

Greg Jorgensen gregj at
Sat Feb 10 13:53:49 EST 2001

In article <10844-3A8572B2-38 at>,
  clickron at 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

Sent via

More information about the Python-list mailing list