From dmstoner at utmb.edu Wed Jul 18 21:54:48 2007 From: dmstoner at utmb.edu (David M. Stoner) Date: Wed, 18 Jul 2007 14:54:48 -0500 Subject: [Idle-dev] IDLE bug seen while using BeautifulSoup.py Message-ID: <469E7008.30704@utmb.edu> I'm not sure if this is the place to submit bug reports. I'm running IDLE 1.1.1 with Python 2.4.1 on Windows XP. It generally works well. (Using 2.4 because, last I checked, that was the latest I could use with PyGTK+.) I'm running a simple application testing Beautiful Soup http://www.crummy.com/software/BeautifulSoup/ Source attached. I get the following error message: Traceback (most recent call last): File "C:\a1\bin\Python24\dms\HTML_Parse\HTML_Parse.py", line 31, in -toplevel- print soup3.body.contents[0] TypeError: 'NoneType' object is not callable At first I assumed it was a bug in BeautifulSoup, but it turns out the script runs fine straight from the command line and under IPython, so it appears IDLE is at fault. Apologies if this is an old bug fixed in 2.5. David Stoner -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: HTML_Parse.py Url: http://mail.python.org/pipermail/idle-dev/attachments/20070718/b0f4f92b/attachment.pot -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/idle-dev/attachments/20070718/b0f4f92b/attachment.html From taleinat at gmail.com Thu Jul 19 17:07:15 2007 From: taleinat at gmail.com (Tal Einat) Date: Thu, 19 Jul 2007 18:07:15 +0300 Subject: [Idle-dev] IDLE bug seen while using BeautifulSoup.py In-Reply-To: <469E7008.30704@utmb.edu> References: <469E7008.30704@utmb.edu> Message-ID: <7afdee2f0707190807l5483de1dgbf01fedb367919bf@mail.gmail.com> On 7/18/07, David M. Stoner wrote: > > I'm not sure if this is the place to submit bug reports. > > I'm running IDLE 1.1.1 with Python 2.4.1 on Windows XP. It generally > works well. (Using 2.4 because, last I checked, that was the latest I > could use with PyGTK+.) > > I'm running a simple application testing Beautiful Soup > http://www.crummy.com/software/BeautifulSoup/ > > Source attached. > > I get the following error message: > > Traceback (most recent call last): > File "C:\a1\bin\Python24\dms\HTML_Parse\HTML_Parse.py", line 31, in > -toplevel- > print soup3.body.contents[0] > TypeError: 'NoneType' object is not callable > > > > At first I assumed it was a bug in BeautifulSoup, but it turns out the > script runs fine straight from the command line and under IPython, so it > appears IDLE is at fault. > > Apologies if this is an old bug fixed in 2.5. > I'm getting a "maximum recursion limit reached" exception on my IDLE 1.2, Python 2.5, WinXP. Congrats, you've found a bug in IDLE! Thank you for reporting it :) The problem is that soup3.body.contents[0] cannot be pickled, even though it is an instance of unicode. Try it - calling pickle.dumps(soup3.body.contents[0]) in the command-line interpreter (after execfile-ing your script) causes infinite recursion and finally the above mentioned exception. This is very bad behavior on behalf of BeautifulSoup! I'll write them an angry memo ;). But IDLE surely should have a try/except block around the pickling code, and on failure fall back to whatever it does for un-pickle-able objects. I'll submit a bug report on SourceForge, and talk with the BeautifulSoup guys while I'm at it. Thanks again for letting us know about this! - Tal P.S. I think you meant to call the renderContents method and print the returned value, instead of printing the method itself. From paul at mustagh.com Fri Jul 20 19:48:40 2007 From: paul at mustagh.com (Paul Guse) Date: Fri, 20 Jul 2007 11:48:40 -0600 Subject: [Idle-dev] open idle edit window only? Message-ID: <005c01c7caf6$3605bde0$6501a8c0@uberchufties> Is there a way to open just the edit window (without the run window) from the commandline? I can go into the idle configuration and change the "At Startup" option to "Open Edit Window" and this does what I'm looking for, but I need to be able to do this without manually going into idle and changing it. I need to be able to control this through the commandline (or equivalent) without making the user set up the options manually. Any suggestions? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/idle-dev/attachments/20070720/fbba9d0c/attachment.htm From taleinat at gmail.com Fri Jul 20 22:59:25 2007 From: taleinat at gmail.com (Tal Einat) Date: Fri, 20 Jul 2007 23:59:25 +0300 Subject: [Idle-dev] open idle edit window only? In-Reply-To: <005c01c7caf6$3605bde0$6501a8c0@uberchufties> References: <005c01c7caf6$3605bde0$6501a8c0@uberchufties> Message-ID: <7afdee2f0707201359y52327c07gc27e85dbbf836f6a@mail.gmail.com> On 7/20/07, Paul Guse wrote: > > > Is there a way to open just the edit window (without the run window) from > the commandline? > I can go into the idle configuration and change the "At Startup" option to > "Open Edit Window" and this does what I'm looking for, but I need to be able > to do this without manually going into idle and changing it. > I need to be able to control this through the commandline (or equivalent) > without making the user set up the options manually. > Any suggestions? > Thanks. Unfortunately, no. As long as the "At Startup" option in the configuration dialog is set to "Open Shell Window", a shell window will always be opened. I agree that there should be a command-line option to explicitly not open a shell window. I'll post a feature request to SourceForge. If you want this quickly, I can work up a quick patch for you. - Tal From paul at mustagh.com Fri Jul 20 23:11:13 2007 From: paul at mustagh.com (Paul Guse) Date: Fri, 20 Jul 2007 15:11:13 -0600 Subject: [Idle-dev] open idle edit window only? References: <005c01c7caf6$3605bde0$6501a8c0@uberchufties> <7afdee2f0707201359y52327c07gc27e85dbbf836f6a@mail.gmail.com> Message-ID: <00c401c7cb12$821061b0$6501a8c0@uberchufties> Thanks for the reply. If a patch is relatively straight forward I would be definitely interested. (time is fairly important). I was thinking of hacking it by changing the config file before I ran idle, but something more elegant would be great :) Paul ----- Original Message ----- From: "Tal Einat" To: "Paul Guse" Cc: Sent: Friday, July 20, 2007 2:59 PM Subject: Re: [Idle-dev] open idle edit window only? > On 7/20/07, Paul Guse wrote: >> >> >> Is there a way to open just the edit window (without the run window) from >> the commandline? >> I can go into the idle configuration and change the "At Startup" option >> to >> "Open Edit Window" and this does what I'm looking for, but I need to be >> able >> to do this without manually going into idle and changing it. >> I need to be able to control this through the commandline (or equivalent) >> without making the user set up the options manually. >> Any suggestions? >> Thanks. > > Unfortunately, no. As long as the "At Startup" option in the > configuration dialog is set to "Open Shell Window", a shell window > will always be opened. > > I agree that there should be a command-line option to explicitly not > open a shell window. I'll post a feature request to SourceForge. > > If you want this quickly, I can work up a quick patch for you. > > - Tal > From dblank at brynmawr.edu Fri Jul 20 22:58:51 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Fri, 20 Jul 2007 16:58:51 -0400 (EDT) Subject: [Idle-dev] open idle edit window only? In-Reply-To: <005c01c7caf6$3605bde0$6501a8c0@uberchufties> References: <005c01c7caf6$3605bde0$6501a8c0@uberchufties> Message-ID: <1126.165.106.10.167.1184965131.squirrel@webmail.brynmawr.edu> On Fri, July 20, 2007 1:48 pm, Paul Guse said: > Is there a way to open just the edit window (without the run window) from > the commandline? > I can go into the idle configuration and change the "At Startup" option to > "Open Edit Window" and this does what I'm looking for, but I need to be > able to do this without manually going into idle and changing it. > I need to be able to control this through the commandline (or equivalent) > without making the user set up the options manually. I don't know how to do what you ask, but I will second the motion that this is an annoyance. It seems that there should be a third option that would open the edit window, given a file to edit, or open the interpreter otherwise. Of course, this is moot if we had the ability to have a single window that was split with editor and interpreter. $.02 -Doug > Any suggestions? > Thanks. > _______________________________________________ > IDLE-dev mailing list > IDLE-dev at python.org > http://mail.python.org/mailman/listinfo/idle-dev > -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 6501 From taleinat at gmail.com Sat Jul 21 00:35:54 2007 From: taleinat at gmail.com (Tal Einat) Date: Sat, 21 Jul 2007 01:35:54 +0300 Subject: [Idle-dev] open idle edit window only? In-Reply-To: <00c401c7cb12$821061b0$6501a8c0@uberchufties> References: <005c01c7caf6$3605bde0$6501a8c0@uberchufties> <7afdee2f0707201359y52327c07gc27e85dbbf836f6a@mail.gmail.com> <00c401c7cb12$821061b0$6501a8c0@uberchufties> Message-ID: <7afdee2f0707201535j261b9e98h3bba86434f79b0e9@mail.gmail.com> On 7/21/07, Paul Guse wrote: > Thanks for the reply. > If a patch is relatively straight forward I would be definitely interested. > (time is fairly important). > I was thinking of hacking it by changing the config file before I ran idle, > but something more elegant would be great :) > Paul > This is actually very simple. In Lib\idlelib\PyShell.py, replace this line: enable_shell = enable_shell or not edit_start With this: enable_shell = enable_shell or not enable_edit That's it. Now, opening a file (or files) with the -e flag should do what you want. I think this is actually a bug, this logic makes more sense. And it seems to me what you want would have been the intended behavior of the -e flag. I'll check this out a bit more, and hopefully post a patch in a matter of days. Thanks for pointing this out - I'd noted this but never really thought about it. User feedback is priceless :) I hope this helps... Good luck! - Tal From taleinat at gmail.com Sat Jul 21 00:49:12 2007 From: taleinat at gmail.com (Tal Einat) Date: Sat, 21 Jul 2007 01:49:12 +0300 Subject: [Idle-dev] open idle edit window only? In-Reply-To: <1126.165.106.10.167.1184965131.squirrel@webmail.brynmawr.edu> References: <005c01c7caf6$3605bde0$6501a8c0@uberchufties> <1126.165.106.10.167.1184965131.squirrel@webmail.brynmawr.edu> Message-ID: <7afdee2f0707201549x28cadb0ch1d61be58a627207a@mail.gmail.com> On 7/20/07, Douglas S. Blank wrote: > On Fri, July 20, 2007 1:48 pm, Paul Guse said: > > Is there a way to open just the edit window (without the run window) from > > the commandline? > > I can go into the idle configuration and change the "At Startup" option to > > "Open Edit Window" and this does what I'm looking for, but I need to be > > able to do this without manually going into idle and changing it. > > I need to be able to control this through the commandline (or equivalent) > > without making the user set up the options manually. > > I don't know how to do what you ask, but I will second the motion that > this is an annoyance. It seems that there should be a third option that > would open the edit window, given a file to edit, or open the interpreter > otherwise. Of course, this is moot if we had the ability to have a single > window that was split with editor and interpreter. Your "third option" would seem to be the obvious default behavior, IMO. I've always wondered at the editor/shell window logic in IDLE. I would expect IDLE to open a shell window if called without arguments, or an editor window if called with one or more arguments. A flag to specifically also open a shell window would suffice to allow opening a shell window alongside editor window(s). But the config option for choosing what should be opened initially, which cannot be overridden from the command line, seems silly. (Especially since opening a shell/editor window is a very simple action.) I think we should remove this config option from IDLE and make the command line options simpler and more intuitive/standard. I feel this would go well with IDLE's philosophy of being as simple as possible, avoiding clutter as much as possible. Just as we avoid excessive GUI elements, we should avoid excessive configuration options. Any feedback on this would be welcome! - Tal From paul at mustagh.com Sat Jul 21 01:24:52 2007 From: paul at mustagh.com (Paul Guse) Date: Fri, 20 Jul 2007 17:24:52 -0600 Subject: [Idle-dev] open idle edit window only? References: <005c01c7caf6$3605bde0$6501a8c0@uberchufties> <1126.165.106.10.167.1184965131.squirrel@webmail.brynmawr.edu> <7afdee2f0707201549x28cadb0ch1d61be58a627207a@mail.gmail.com> Message-ID: <00ea01c7cb25$2d632810$6501a8c0@uberchufties> Simplicity is definitely a good way to go. Looking at the options in Option->Configure idle.. it seems to me that there are a couple of options that would be handy to be able to set in the commandline. Fonts/Highlighting/Keys could all be ignored as this is pretty specific to each user, but I would make use of the ability to change (in the general tab) the Startup Preference, Autosave pref, and possible window size (although less likely). I'm using python as an embedded scripting language and having these options would really allow me to tailor idle to my needs. Writing to the config files might not be an option if the user does not have permission to do so. I could change the config upon installation, but messing with the user's settings is always a bit suspect. Definitely the startup pref is the most importan, I believe. Paul ----- Original Message ----- From: "Tal Einat" To: "Douglas S. Blank" Cc: "Paul Guse" ; Sent: Friday, July 20, 2007 4:49 PM Subject: Re: [Idle-dev] open idle edit window only? > On 7/20/07, Douglas S. Blank wrote: >> On Fri, July 20, 2007 1:48 pm, Paul Guse said: >> > Is there a way to open just the edit window (without the run window) >> > from >> > the commandline? >> > I can go into the idle configuration and change the "At Startup" option >> > to >> > "Open Edit Window" and this does what I'm looking for, but I need to be >> > able to do this without manually going into idle and changing it. >> > I need to be able to control this through the commandline (or >> > equivalent) >> > without making the user set up the options manually. >> >> I don't know how to do what you ask, but I will second the motion that >> this is an annoyance. It seems that there should be a third option that >> would open the edit window, given a file to edit, or open the interpreter >> otherwise. Of course, this is moot if we had the ability to have a single >> window that was split with editor and interpreter. > > Your "third option" would seem to be the obvious default behavior, IMO. > > I've always wondered at the editor/shell window logic in IDLE. I would > expect IDLE to open a shell window if called without arguments, or an > editor window if called with one or more arguments. A flag to > specifically also open a shell window would suffice to allow opening a > shell window alongside editor window(s). But the config option for > choosing what should be opened initially, which cannot be overridden > from the command line, seems silly. (Especially since opening a > shell/editor window is a very simple action.) > > I think we should remove this config option from IDLE and make the > command line options simpler and more intuitive/standard. I feel this > would go well with IDLE's philosophy of being as simple as possible, > avoiding clutter as much as possible. Just as we avoid excessive GUI > elements, we should avoid excessive configuration options. > > Any feedback on this would be welcome! > > - Tal > From taleinat at gmail.com Sat Jul 21 01:44:41 2007 From: taleinat at gmail.com (Tal Einat) Date: Sat, 21 Jul 2007 02:44:41 +0300 Subject: [Idle-dev] open idle edit window only? In-Reply-To: <00ea01c7cb25$2d632810$6501a8c0@uberchufties> References: <005c01c7caf6$3605bde0$6501a8c0@uberchufties> <1126.165.106.10.167.1184965131.squirrel@webmail.brynmawr.edu> <7afdee2f0707201549x28cadb0ch1d61be58a627207a@mail.gmail.com> <00ea01c7cb25$2d632810$6501a8c0@uberchufties> Message-ID: <7afdee2f0707201644v56f5a94eh54fcfd42fd53218e@mail.gmail.com> On 7/21/07, Paul Guse wrote: > Looking at the options in Option->Configure idle.. it seems to me that there > are a couple of options that would be handy to be able to set in the > commandline. > Fonts/Highlighting/Keys could all be ignored as this is pretty specific to > each user, but I would make use of the ability to change (in the general > tab) the Startup Preference, Autosave pref, and possible window size > (although less likely). > I'm using python as an embedded scripting language and having these options > would really allow me to tailor idle to my needs. Writing to the config > files might not be an option if the user does not have permission to do so. > I could change the config upon installation, but messing with the user's > settings is always a bit suspect. > Definitely the startup pref is the most importan, I believe. > Paul That seems like a bit much for my taste... Though I can see this being useful when using IDLE as an interface for something, where you may want to avoid bugging users with saving files all of the time. This is a step in the direction of IDLE as a configurable shell environment, usable as a generic front-end, which would require it to be somewhat configurable. I've heard several people thinking in such directions lately, but I'm afraid there isn't enough development force behind IDLE to bring it to that point. As I see it, IPython is a better candidate for such uses, if only because its development is drastically more active. Though in its current state, its text-only interface is certainly a major drawback for common users compared to IDLE. As for a solution: You could set these in the user configuration in his .idlerc directory, instead of the global config. Any user should have write access to this directory. See the beginning of Lib\idlelib\config-main.def for details. - Tal From dblank at brynmawr.edu Thu Jul 26 04:30:21 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Wed, 25 Jul 2007 22:30:21 -0400 (EDT) Subject: [Idle-dev] IDLE getpass? Message-ID: <1628.71.59.123.159.1185417021.squirrel@webmail.brynmawr.edu> Is there an easy way that one can enter a password in IDLE but not have the characters show (or just show asterisks)? The only way I can think of is to bind() but that seems to be overkill. I'm looking for something like replacing sys.stdout or some Tkinter function. Any hints appreciated. -Doug -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 6501 From taleinat at gmail.com Thu Jul 26 08:36:42 2007 From: taleinat at gmail.com (Tal Einat) Date: Thu, 26 Jul 2007 09:36:42 +0300 Subject: [Idle-dev] IDLE getpass? In-Reply-To: <1628.71.59.123.159.1185417021.squirrel@webmail.brynmawr.edu> References: <1628.71.59.123.159.1185417021.squirrel@webmail.brynmawr.edu> Message-ID: <7afdee2f0707252336m14e27b5ep3bc933802f010cc6@mail.gmail.com> On 7/26/07, Douglas S. Blank wrote: > Is there an easy way that one can enter a password in IDLE but not have > the characters show (or just show asterisks)? The only way I can think of > is to bind() but that seems to be overkill. I'm looking for > something like replacing sys.stdout or some Tkinter function. Any hints > appreciated. A good starting point would be: from tkSimpleDialog import askstring askstring('Enter Password', 'Password: ', show='*') You'd have to work out a few Tk kinks to get it to work smoothly... but it works. - Tal From dblank at brynmawr.edu Thu Jul 26 19:59:52 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Thu, 26 Jul 2007 13:59:52 -0400 Subject: [Idle-dev] IDLE getpass? In-Reply-To: <7afdee2f0707252336m14e27b5ep3bc933802f010cc6@mail.gmail.com> References: <1628.71.59.123.159.1185417021.squirrel@webmail.brynmawr.edu> <7afdee2f0707252336m14e27b5ep3bc933802f010cc6@mail.gmail.com> Message-ID: <46A8E118.8030101@brynmawr.edu> Tal Einat wrote: > On 7/26/07, Douglas S. Blank wrote: >> Is there an easy way that one can enter a password in IDLE but not have >> the characters show (or just show asterisks)? The only way I can think of >> is to bind() but that seems to be overkill. I'm looking for >> something like replacing sys.stdout or some Tkinter function. Any hints >> appreciated. > > A good starting point would be: > > from tkSimpleDialog import askstring > askstring('Enter Password', 'Password: ', show='*') > > You'd have to work out a few Tk kinks to get it to work smoothly... > but it works. Thanks for the pointer. This brings up some additional questions: 1) It looks like that the trick here is to set entry.configure(show='*'). Can that be done in the Python Shell in IDLE? That is, can one temporarily make all characters that you type in the Python Shell be *? 2) How does one get a hold of the PyShell once IDLE has already started? (If this is possible, I'd like to know for other reasons besides this one). 3) If I have to open a Tk window, how can I get it to appear on top of the IDLE window? Thanks for any additional hints, -Doug > - Tal > From taleinat at gmail.com Sun Jul 29 23:16:11 2007 From: taleinat at gmail.com (Tal Einat) Date: Mon, 30 Jul 2007 00:16:11 +0300 Subject: [Idle-dev] IDLE getpass? In-Reply-To: <46A8E118.8030101@brynmawr.edu> References: <1628.71.59.123.159.1185417021.squirrel@webmail.brynmawr.edu> <7afdee2f0707252336m14e27b5ep3bc933802f010cc6@mail.gmail.com> <46A8E118.8030101@brynmawr.edu> Message-ID: <7afdee2f0707291416u3495ede0v566167e03b11b6b9@mail.gmail.com> On 7/26/07, Douglas S. Blank wrote: > Tal Einat wrote: > > On 7/26/07, Douglas S. Blank wrote: > >> Is there an easy way that one can enter a password in IDLE but not have > >> the characters show (or just show asterisks)? The only way I can think of > >> is to bind() but that seems to be overkill. I'm looking for > >> something like replacing sys.stdout or some Tkinter function. Any hints > >> appreciated. > > > > A good starting point would be: > > > > from tkSimpleDialog import askstring > > askstring('Enter Password', 'Password: ', show='*') > > > > You'd have to work out a few Tk kinks to get it to work smoothly... > > but it works. > > Thanks for the pointer. This brings up some additional questions: > > 1) It looks like that the trick here is to set > entry.configure(show='*'). Can that be done in the Python Shell in IDLE? > That is, can one temporarily make all characters that you type in the > Python Shell be *? Not on the Tk level as you can with Entry widgets. But an IDLE extension can hook on to the EditorWindow object's 'write' method, and change it to show an asterisk ('*') instead of any input. You could write an extension for password entry, which temporarily overrides this 'write' method, and when the user is done returns the write method to its original form. You'd have to be a bit careful though, for instance, make sure the shell is restored if the user hits Ctrl+C. > 2) How does one get a hold of the PyShell once IDLE has already started? > (If this is possible, I'd like to know for other reasons besides this one). Well, that's precisely what extensions get - the EditorWindow object, which is the PyShell object in the case of the shell window. > 3) If I have to open a Tk window, how can I get it to appear on top of > the IDLE window? IIRC this depends on your window manager. Tk's 'raise' command ('tkraise' in Python's Tkinter, because 'raise' is a Python keyword) just doesn't work on windows - this is a well known bug. I seem to recall that the TopLevel widgets' 'wm_deiconify' method has something to do with it... Try a Google Groups search on this issue + Tk, and you should find an answer. > Thanks for any additional hints, > > -Doug Sorry for the unusually delayed reply! - Tal