[Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Laura Creighton
see the following: lac@smartwheels:~/junk$ echo "print ('hello there')" >string.py lac@smartwheels:~/junk$ idle-python3.5 hello there Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.5/idlelib/run.py", line 10, in from idlelib import CallTips File

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Nathaniel Smith
On Oct 29, 2015 10:22 AM, "Brett Cannon" wrote: > > > > On Thu, 29 Oct 2015 at 09:00 Laura Creighton wrote: >> >> >> see the following: >> lac@smartwheels:~/junk$ echo "print ('hello there')" >string.py >> lac@smartwheels:~/junk$ idle-python3.5 >> hello there

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Brett Cannon
On Thu, 29 Oct 2015 at 09:00 Laura Creighton wrote: > > see the following: > lac@smartwheels:~/junk$ echo "print ('hello there')" >string.py > lac@smartwheels:~/junk$ idle-python3.5 > hello there > Traceback (most recent call last): > File "", line 1, in > File

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Laura Creighton
In a message of Thu, 29 Oct 2015 19:13:08 +, Paul Moore writes: >> I am actually sick of the 'consenting adults' argument. >> I am dealing with '11 year old children trying to write their >> first, third and tenth python programs'. For the life of me >> I cannot see how convenience for the

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Laura Creighton
In a message of Thu, 29 Oct 2015 19:30:09 +, Paul Moore writes: >On 29 October 2015 at 18:45, Donald Stufft wrote: >> So I don=E2=80=99t think it=E2=80=99s true that people don=E2=80=99t shad= >> ow the standard library, they just have various ways to do it that have s= >>

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Laura Creighton
In a message of Thu, 29 Oct 2015 18:27:59 +, Paul Moore writes: >The idle issues seem to me to demonstrate that shadowing the stdlib is >a bad idea. Of course, consenting adults, and if you override you're >responsible for correctly replacing the functionality, and all that, >but honestly, I

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Paul Moore
On 29 October 2015 at 18:46, Laura Creighton wrote: > In a message of Thu, 29 Oct 2015 18:27:59 +, Paul Moore writes: >>The idle issues seem to me to demonstrate that shadowing the stdlib is >>a bad idea. Of course, consenting adults, and if you override you're >>responsible

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Paul Moore
On 29 October 2015 at 17:36, Donald Stufft wrote: > On October 29, 2015 at 1:32:31 PM, Nathaniel Smith (n...@pobox.com) wrote: >> > (I know saying that last part out loud will probably just cause >> someone to pop out of the woodwork and explain how shadowing the >> sys module

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Donald Stufft
On October 29, 2015 at 2:28:02 PM, Paul Moore (p.f.moore=40gmail.com) wro= te: > On 29 October 2015 at 17:36, Donald Stufft wrote: > > On October 29, 2015 at 1:32:31 PM, Nathaniel Smith (njs=40pobox.com) = wrote: > >> > (I know saying that last part out loud will probably just cause > >> someone

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Nathaniel Smith
On Oct 29, 2015 11:45 AM, "Donald Stufft" wrote: > > Every test runner that includes a =E2=80=94pdb flag that will automatical= > ly invoke pdb at the point of failure. If pdb++ didn=E2=80=99t force the = > shadowing of stdlib, then every single test runner would need an option

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Paul Moore
On 29 October 2015 at 18:45, Donald Stufft wrote: > So I don=E2=80=99t think it=E2=80=99s true that people don=E2=80=99t shad= > ow the standard library, they just have various ways to do it that have s= > everal gotchas and require people to generally hack around the

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Matthias Bussonnier
> On Oct 29, 2015, at 11:46, Laura Creighton wrote: > > In a message of Thu, 29 Oct 2015 18:27:59 +, Paul Moore writes: >> The idle issues seem to me to demonstrate that shadowing the stdlib is >> a bad idea. Of course, consenting adults, and if you override you're >>

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Mark Roseman
Laura, I think what you want should actually be more-or-less doable in IDLE. The main routine that starts IDLE should be able to detect if it starts correctly (something unlikely to happen if a significant stdlib module is shadowed), watch for an attribute error of that form and try to

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Laura Creighton
In a message of Thu, 29 Oct 2015 13:26:08 -0700, Mark Roseman writes: >Laura, I think what you want should actually be more-or-less doable in IDLE. > >The main routine that starts IDLE should be able to detect if it starts >correctly (something unlikely to happen if a significant stdlib module is

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Mark Roseman
> Need I submit a bug report/feature request to get this happening? > Very, very pleased to have mentioned it … I took care of the bug report. Glad you mentioned it. My personal opinion is that many of the error messages in IDLE (to say nothing of large parts of the overall user experience) are

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Glenn Linderman
On 10/29/2015 12:30 PM, Paul Moore wrote: On 29 October 2015 at 18:45, Donald Stufft wrote: So I don=E2=80=99t think it=E2=80=99s true that people don=E2=80=99t shad= ow the standard library, they just have various ways to do it that have s= everal gotchas and require people

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Ryan Gonzalez
Why not just check the path of the imported modules and compare it with the Python library directory? On October 29, 2015 3:26:08 PM CDT, Mark Roseman wrote: >Laura, I think what you want should actually be more-or-less doable in >IDLE. > >The main routine that starts IDLE

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Laura Creighton
In a message of Thu, 29 Oct 2015 15:50:30 -0500, Ryan Gonzalez writes: >Why not just check the path of the imported modules and compare it with the >Python library directory? My friend Åsa who is 12 years old suggested exactly this at the club. If this works then I will be certain to mention

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Ryan Gonzalez
Well, tell your friend that that means middle and high schoolers must think alike! :D On Thu, Oct 29, 2015 at 4:18 PM, Laura Creighton wrote: > In a message of Thu, 29 Oct 2015 15:50:30 -0500, Ryan Gonzalez writes: > >Why not just check the path of the imported modules and

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Donald Stufft
On October 29, 2015 at 1:32:31 PM, Nathaniel Smith (n...@pobox.com) wrote: > > (I know saying that last part out loud will probably just cause > someone to pop out of the woodwork and explain how shadowing the > sys module is a great idea and they do it all the time or whatever, > but I

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Ryan Gonzalez
Well, this works on Python 2 only (I'm on a phone with only access to 2 right now), but this is a start (apologies for the screwy syntax highlighting): import sys, imp, logging, os modules = ''' imp string ... '''.split() class StdlibTester(object): base =

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Nathaniel Smith
On Thu, Oct 29, 2015 at 1:50 PM, Ryan Gonzalez wrote: > Why not just check the path of the imported modules and compare it with the > Python library directory? It works, but it requires that everyone who could run into this problem carefully add some extra guard code to every

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread R. David Murray
On Thu, 29 Oct 2015 16:56:38 -0700, Nathaniel Smith wrote: > On Thu, Oct 29, 2015 at 1:50 PM, Ryan Gonzalez wrote: > > Why not just check the path of the imported modules and compare it with the > > Python library directory? > > It works, but it requires that

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Terry Reedy
On 10/29/2015 4:53 PM, Mark Roseman wrote: Need I submit a bug report/feature request to get this happening? Very, very pleased to have mentioned it … I took care of the bug report. The idle issue is https://bugs.python.org/issue25514 As I said there, I think that removing '' from sys.path,

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Terry Reedy
On 10/29/2015 11:59 AM, Laura Creighton wrote: see the following: lac@smartwheels:~/junk$ echo "print ('hello there')" >string.py lac@smartwheels:~/junk$ idle-python3.5 hello there Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.5/idlelib/run.py", line 10,

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-29 Thread Terry Reedy
On 10/29/2015 5:18 PM, Laura Creighton wrote: In a message of Thu, 29 Oct 2015 15:50:30 -0500, Ryan Gonzalez writes: Why not just check the path of the imported modules and compare it with the Python library directory? My friend Åsa who is 12 years old suggested exactly this at the club.