Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #92685

Re: Creating .exe file in Python

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 <ian.g.kelly@gmail.com>
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> <mailman.487.1434385760.13271.python-list@python.org> <5f6b802f-049b-48e3-b1fd-a5915b7f3dbb@googlegroups.com> <mailman.515.1434467117.13271.python-list@python.org> <2de8f2c1-5a92-4f8b-be2d-c793de69d463@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 16 Jun 2015 10:00:22 -0600
Subject Re: Creating .exe file in Python
To Python <python-list@python.org>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.517.1434470471.13271.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Tue, Jun 16, 2015 at 9:17 AM,  <subhabrata.banerji@gmail.com> 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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-15 04:42 -0700
  Re: Creating .exe file in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-15 13:07 +0100
    Re: Creating .exe file in Python sohcahtoa82@gmail.com - 2015-06-15 10:09 -0700
  Re: Creating .exe file in Python Laura Creighton <lac@openend.se> - 2015-06-15 15:01 +0200
    Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-15 06:42 -0700
      Re: Creating .exe file in Python Laura Creighton <lac@openend.se> - 2015-06-15 16:44 +0200
  Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-15 07:03 -0700
    Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-15 07:40 -0700
  Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-15 09:11 -0700
    Re: Creating .exe file in Python Laura Creighton <lac@openend.se> - 2015-06-15 18:29 +0200
      Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-16 03:46 -0700
      Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-16 06:56 -0700
        Re: Creating .exe file in Python Laura Creighton <lac@openend.se> - 2015-06-16 17:04 +0200
          Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-16 08:17 -0700
            Re: Creating .exe file in Python Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-16 10:00 -0600
            Re: Creating .exe file in Python Chris Angelico <rosuav@gmail.com> - 2015-06-17 02:03 +1000
              Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-16 09:23 -0700
              Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-17 06:10 -0700
                Re: Creating .exe file in Python Chris Angelico <rosuav@gmail.com> - 2015-06-17 23:20 +1000
                Re: Creating .exe file in Python hamilton <hamilton@nothere.com> - 2015-06-17 07:33 -0600
                Re: Creating .exe file in Python Chris Angelico <rosuav@gmail.com> - 2015-06-17 23:52 +1000
                Re: Creating .exe file in Python Steven D'Aprano <steve@pearwood.info> - 2015-06-18 01:39 +1000
                Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-17 08:46 -0700
                Re: Creating .exe file in Python Chris Angelico <rosuav@gmail.com> - 2015-06-18 01:58 +1000
                Re: Creating .exe file in Python random832@fastmail.us - 2015-06-17 10:17 -0400
                Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-17 07:30 -0700
                Re: Creating .exe file in Python Chris Angelico <rosuav@gmail.com> - 2015-06-18 00:38 +1000
                Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-17 06:33 -0700
                Re: Creating .exe file in Python Laura Creighton <lac@openend.se> - 2015-06-17 15:54 +0200
                Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-17 07:04 -0700
  Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-17 07:16 -0700
    Re: Creating .exe file in Python Laura Creighton <lac@openend.se> - 2015-06-17 17:21 +0200
      Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-17 08:30 -0700

csiph-web