Mailing List Archive

Incompatibility.py
The following program gives different results under IDLE:
------------------------
''' To explore the Name given to a program, using DOS, PythonWin and IDLE.
'''
print 'The name is:', __name__
-----------------------
DOS command line returns: The name is: __main__
PythonWin returns: The name is: __main__
IDLE returns: The name is: Incompatibility

Since test routines typically rely on the former, such routines, as for example
urllib.py,
fail under IDLE.

Colin W.
Incompatibility.py [ In reply to ]
Colin J. Williams wrote in message <379C8BB3.12D50F27@connection.com>...

>IDLE returns: The name is: Incompatibility

Not for IDLE 0.5 it doesnt. Are you sure you are not using "Import Script".
IDLE definately does this, as Python uses the "if __name__=='__main__':"
idiom extensively - and IDLE would be useless for running scripts if it did
as you describe.

The behaviour you describe sounds like you are simply confusing "Run Script"
with "Import Script".

Mark.
Incompatibility.py [ In reply to ]
[Colin J. Williams]
> IDLE returns: The name is: Incompatibility

[Mark Hammond]
> Not for IDLE 0.5 it doesnt. Are you sure you are not using
> "Import Script".
> ...
> The behaviour you describe sounds like you are simply confusing
> "Run Script" with "Import Script".

Except that "Run Script" doesn't exist in the released IDLE -- you have to
get the CVS version for that.

Since Guido doesn't have anything else to do <wink>, I vote he fixes it so
breakpoints can be set under Windows again, then put out a new IDLE release
+ updated Lib/pyclbr.py. The CVS is version is gads better in several key
ways.

release-early-&-often-ly y'rs - tim
Incompatibility.py [ In reply to ]
Mark,

I enter IDLE, from the W95 Desktop, with the Target set to IDLE.py
and the Start In set to the working directory. Similarly, for PythonWin,
the Target is PythonWin.exe. The results are as reported below.

At one time one could set breakpoints in IDLE, this capability was lost
in some later download.

I applaud the Tim Peters suggestion in this thread. It would also be nice
if the IDLE line number were displayed, as is done in PythonWin.

Thanks,

Colin W.

Mark Hammond wrote:

> Colin J. Williams wrote in message <379C8BB3.12D50F27@connection.com>...
>
> >IDLE returns: The name is: Incompatibility
>
> Not for IDLE 0.5 it doesnt. Are you sure you are not using "Import Script".
> IDLE definately does this, as Python uses the "if __name__=='__main__':"
> idiom extensively - and IDLE would be useless for running scripts if it did
> as you describe.
>
> The behaviour you describe sounds like you are simply confusing "Run Script"
> with "Import Script".
>
> Mark.
Incompatibility.py [ In reply to ]
Incidentally, PTUI returns:The name is:__builtins__

Colin W.

Tim Peters wrote:

> [Colin J. Williams]
> > IDLE returns: The name is: Incompatibility
>
> [Mark Hammond]
> > Not for IDLE 0.5 it doesnt. Are you sure you are not using
> > "Import Script".
> > ...
> > The behaviour you describe sounds like you are simply confusing
> > "Run Script" with "Import Script".
>
> Except that "Run Script" doesn't exist in the released IDLE -- you have to
> get the CVS version for that.
>
> Since Guido doesn't have anything else to do <wink>, I vote he fixes it so
> breakpoints can be set under Windows again, then put out a new IDLE release
> + updated Lib/pyclbr.py. The CVS is version is gads better in several key
> ways.
>
> release-early-&-often-ly y'rs - tim