Creating .exe file in Python

subhabrata.banerji at gmail.com subhabrata.banerji at gmail.com
Tue Jun 16 11:17:52 EDT 2015


On Tuesday, June 16, 2015 at 8:35:39 PM UTC+5:30, Laura Creighton wrote:
> In a message of Tue, 16 Jun 2015 06:56:12 -0700,  writes:
> >ii) In a class how may I include if __name__ == "__main__": with multiple methods? But I think this is easy question there should be lot of web help. 
> >
> >If anyone may kindly suggest.
> >
> >Regards,
> >Subhabrata Banerjee. 
> 
> There is something wrong in the way you are thinking about this.
> You don't _want_ to stick if __name__ = "__main__":
> into every class you write.
> 
> See if reading this helps.
> http://effbot.org/pyfaq/tutor-what-is-if-name-main-for.htm
> 
> Laura

Hi,
Thanks. The scipy issue seems solved. But this silly issue is giving so much of time. I am checking. Please see a sample code, 

import sys
sys.stderr = sys.stdout
class Colors:
    def Blue(self):
        self.var="This is Blue"
        print self.var
    def Red(self):
        print self.var
        
    
       
if __name__ == "__main__":
    Colors().Blue() #THIS IS FINE
    Colors().Red() #NOT FINE

Regards,
Subhabrata Banerjee. 



More information about the Python-list mailing list