[ python-Bugs-923576 ] Incorrect __name__ assignment

SourceForge.net noreply at sourceforge.net
Wed Jun 2 17:28:30 EDT 2004


Bugs item #923576, was opened at 2004-03-26 01:43
Message generated for change (Comment added) made by jackjansen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=923576&group_id=5470

Category: Macintosh
Group: Python 2.3
>Status: Closed
>Resolution: Works For Me
Priority: 5
Submitted By: El cepi (elcepi)
>Assigned to: Jack Jansen (jackjansen)
Summary: Incorrect __name__ assignment

Initial Comment:
When you use PythonLauncher or PythonIDE the value of 
__name__ is incorrectly assigned.

For example, in the attached file the output is "The module 
has been load" when the module is fun in PythonIDE.

With this you can not disciminate between the code you 
should run when you load the module and when you try to 
run it.



----------------------------------------------------------------------

>Comment By: Jack Jansen (jackjansen)
Date: 2004-06-02 23:28

Message:
Logged In: YES 
user_id=45365

First off: sorry for not replying sooner, I hadn't seen the bug report.

Second: I don't think this is a bug:-)
In the case of running the script in the PythonIDE: if you want the script 
to be run as a main program you need to check the "Run as __main__" 
menu entry (in the run options popup menu, at the top of the vertical 
scrollbar).

In the case of running the script with PythonLauncher I don't see the 
problem: for me it prints "The module has been run".

If there's a scenario whereby running with PythonLauncher does print 
"The module has been load": please reopen the bug report and provide a 
scenario.

----------------------------------------------------------------------

Comment By: El cepi (elcepi)
Date: 2004-03-31 21:14

Message:
Logged In: YES 
user_id=1006669

No problem tjreedy

Here are the version information relevant to the report

* PythonIDE
  Version 1.0.1
  Python 2.3.3 (#1 March 12 2004, 13:49:58)
  GCC 3.1 20020420 (prerelease)

* PythonLauncher
  Version 0.1

* Mac OS X 
  Version 10.2.8 (6R73) 
  Darwin Kernel Version 6.8: Wed Sep 10 15:20:55 PDT 2003;
       root:xnu/xnu-344.49.obj~2/RELEASE_PPC

* Machine
  PowerBook G4 (version = 11.3)

This bug cause that your applications behave different when are 
executed from PythonLauncher or PythonIDE than from the shell 

For example, If I double-click the foo.pyc file it is executed by 
PythonLauncher but it execute the code under __name__==’test’ 
instead of under __name__==’__main__’ as append when I run it 
from the shell.


----------------------------------------------------------------------

Comment By: Terry J. Reedy (tjreedy)
Date: 2004-03-31 17:07

Message:
Logged In: YES 
user_id=593130

Lesson learned to check that header field.  Inappropriate 
comments withdrawn.

----------------------------------------------------------------------

Comment By: Michael Hudson (mwh)
Date: 2004-03-31 12:56

Message:
Logged In: YES 
user_id=6656

Terry, this bug is in the 'Macintosh' category for a reason :-)

----------------------------------------------------------------------

Comment By: Terry J. Reedy (tjreedy)
Date: 2004-03-30 19:14

Message:
Logged In: YES 
user_id=593130

When making a bug report, please include at least the Python 
version.  The system you are running on is sometimes 
essential info also.

I am not familiar with either PythonLauncher or PythonIDE.  
Just PyWin and Idle.  If they are third-party items not part of 
the distribution, then this report should go to their authors.

'When you use' is also somewhat vague.  Saying what 
command line option or menu entry or buttom you used to 
run/load might also get a better answer.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=923576&group_id=5470



More information about the Python-bugs-list mailing list