Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '16,': 0.03; 'subject:Python': 0.05; 'scipy': 0.05; 'sys': 0.05; '"__main__":': 0.07; '__name__': 0.07; 'subject:file': 0.07; 'attribute.': 0.09; 'block.': 0.09; 'complaining': 0.09; 'creighton': 0.09; 'noted,': 0.09; 'sys.stderr': 0.09; 'sys.stdout': 0.09; '"this': 0.13; 'def': 0.14; 'output': 0.15; '#this': 0.16; 'helps.': 0.16; 'silly': 0.16; 'write.': 0.16; 'wrote:': 0.16; 'attribute': 0.18; 'laura': 0.18; 'work,': 0.21; 'thanks.': 0.22; 'assuming': 0.22; 'stick': 0.22; 'subject: .': 0.22; 'am,': 0.23; 'code,': 0.23; 'help.': 0.23; '2015': 0.23; 'import': 0.24; 'seems': 0.24; 'header:In-Reply-To:1': 0.24; 'question': 0.26; 'followed': 0.27; 'var': 0.27; 'message-id:@mail.gmail.com': 0.28; 'this.': 0.28; 'fine': 0.29; "i'm": 0.29; '-0700,': 0.29; 'checking.': 0.29; 'maybe': 0.31; 'print': 0.31; 'entry': 0.31; 'run': 0.32; 'anyone': 0.32; 'probably': 0.32; 'point': 0.33; 'class': 0.33; 'received:google.com': 0.34; 'wrong': 0.35; 'to:addr:python-list': 0.35; 'set.': 0.35; 'something': 0.35; 'but': 0.36; 'url:org': 0.36; 'there': 0.36; 'hi,': 0.37; 'should': 0.37; 'subject:: ': 0.37; 'tue,': 0.38; 'to:addr:python.org': 0.39; 'easy': 0.60; 'your': 0.60; 'sample': 0.62; 'more': 0.62; 'kindly': 0.64; 'url:htm': 0.73; '>if': 0.84; 'solved.': 0.84; 'to:name:python': 0.84; 'utc+5:30,': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=gua7T9IT59c30u3K4zaMVcNnS5vDRY9yA9HQwoy2n8A=; b=f/Gci3zMLMh2lw+IQVSWY8lRqXrYk16SqnmCEyYCa1aS+d/rw02/s7m8GOw+KiOKXP NFvdq5jODZjRkKKMQH6ijmaWpkfGGX/HNl1rUc0G09yk1Pt2yqWN+pRJduhEeeqy2b/z Hnq/mee/x+TTxVcnfdC8NJ614wCgVtR/C2G2ocrIa9i6VqInigrbIPb9FfC5N3kLtwPu lyGEURklyCvOfnpN2zN0Xg328AfFNA6G+C5Gpb5R8wpYJbjHhP0UyuqDSw6wiTVl+VbZ EKDArnoU2mmTGs+onxTAjgm9/EUBS04QMP3KKlSc02aqrrjnB42/Eg2RPdYWNi8KICOQ n/kg== X-Received: by 10.170.76.5 with SMTP id s5mr1274257yks.93.1434470462664; Tue, 16 Jun 2015 09:01:02 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <2de8f2c1-5a92-4f8b-be2d-c793de69d463@googlegroups.com> References: <349bb66f-bd3c-47ec-bd1d-35f46d23cf95@googlegroups.com> <2219d0b2-24a4-498b-b981-456faf0ceb44@googlegroups.com> <5f6b802f-049b-48e3-b1fd-a5915b7f3dbb@googlegroups.com> <2de8f2c1-5a92-4f8b-be2d-c793de69d463@googlegroups.com> From: Ian Kelly Date: Tue, 16 Jun 2015 10:00:22 -0600 Subject: Re: Creating .exe file in Python To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 45 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1434470471 news.xs4all.nl 2905 [2001:888:2000:d::a6]:57637 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:92685 On Tue, Jun 16, 2015 at 9:17 AM, wrote: > 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 I'm assuming that when you run this, you get the output "This is Blue" followed by an AttributeError from Colors.Red complaining that the var attribute is not set. If you want this to work, then maybe you should set the attribute. But as Laura noted, you probably don't want to be calling more than one thing in your if __name__ == "__main__" block. Just call the entry point of your program.