A big problem with _name_ == '_main_'

Tommy Grav tgrav at mac.com
Sun Sep 2 02:45:37 CEST 2007


On Sep 1, 2007, at 8:35 PM, onurays wrote:
> I have begun to teach me Python today. The problem is :
>
>     NameError: name 'name' is not defined.
>
> I am using winXP and i used that:
>
>     if  _name_ == '_main_' :
>         MyClass()
>         gtk.main()
>
> Onuray.

I believe that should be a double underscore

if __name__ == '__main__':
	MyClass()
	gtk.main()

Cheers
   Tommy




More information about the Python-list mailing list