Spot on Wayne, that's the 2.6 bug. The fix is now in python svn so it
shouldn't be an issue for Python >= 2.6.1 (which unfortunately isn't
out yet).
If you don't like the look of the patch, you can just change the line in
Tkinter.py : class Menu: def delete
from >
if c in self._tclCommands:
to >
if c and c in self._tclCommands:
Dan
On 7 Nov 2008, at 11:21, Wayne Boucher wrote:
> Hello,
>
> That sounds suspiciously like a bug that Dan found in Python 2.6, so
> maybe
> it's also there in 2.5?? I've attached a fix for 2.6. To apply it cd
> into /usr/lib/python2.5/lib-tk/ and do:
>
> patch < broken2.6_tkinter_patch.diff
>
> Well, backup the existing Tkinter.py just to be safe. And then do a
> diff
> on the old and the new after doing the patch. When I did a diff on
> the
> 2.6 Tkinter.py I got the result at the bottom. If you have a lot more
> diffs than that then it's possible (likely) this patch won't work in
> 2.5
> (although a hand edit might work).
>
> Wayne
>
> diff Tkinter.py.orig Tkinter.py
> 1923a1924,1925
>> if self._tclCommands is None:
>> self._tclCommands = []
> 2661c2663
> < """Delete menu items between INDEX1 and INDEX2 (not
> included)."""
> ---
>> """Delete menu items between INDEX1 and INDEX2 (included)."""
> 2664,2671c2666,2675
> < cmds = []
> < (num_index1, num_index2) = (self.index(index1),
> self.index(index2))
> < if (num_index1 is not None) and (num_index2 is not None):
> < for i in range(num_index1, num_index2 + 1):
> < if 'command' in self.entryconfig(i):
> < c = str(self.entrycget(i, 'command'))
> < if c in self._tclCommands:
> < cmds.append(c)
> ---
>>
>> num_index1, num_index2 = self.index(index1),
>> self.index(index2)
>> if (num_index1 is None) or (num_index2 is None):
>> num_index1, num_index2 = 0, -1
>>
>> for i in range(num_index1, num_index2 + 1):
>> if 'command' in self.entryconfig(i):
>> c = str(self.entrycget(i, 'command'))
>> if c:
>> self.deletecommand(c)
> 2673,2674d2676
> < for c in cmds:
> < self.deletecommand(c)
>
>
> On Fri, 7 Nov 2008, Magnus Lundborg wrote:
>
>> Hello,
>>
>> Recently I've started encountering errors like this a lot:
>>
>>>>> Exception in Tkinter callback
>> Traceback (most recent call last):
>> File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 1417, in __call__
>> return self.func(*args)
>> File
>> "/home/magnusl/CCPN/ccpnmr/ccpnmr2.0/python/ccpnmr/analysis/
>> AnalysisPopup.py",
>> line 1158, in openProject
>> help_url=determineHelpUrl(OpenProjectPopup))
>> File
>> "/home/magnusl/CCPN/ccpnmr/ccpnmr2.0/python/ccpnmr/analysis/
>> AnalysisPopup.py",
>> line 1143, in openPopup
>> transient=transient, *args, **kw)
>> File
>> "/home/magnusl/CCPN/ccpnmr/ccpnmr2.0/python/memops/editor/
>> OpenProjectPopup.py",
>> line 93, in __init__
>> BasePopup.__init__(self, parent=parent, title=title, *args, **kw)
>> File
>> "/home/magnusl/CCPN/ccpnmr/temporaryReleaseDir/ccpnmr/ccpnmr2.0/
>> python/memops/editor/BasePopup.py",
>> line 85, in __init__
>> File
>> "/home/magnusl/CCPN/ccpnmr/temporaryReleaseDir/ccpnmr/ccpnmr2.0/
>> python/memops/gui/BasePopup.py",
>> line 124, in __init__
>> File
>> "/home/magnusl/CCPN/ccpnmr/ccpnmr2.0/python/memops/editor/
>> OpenProjectPopup.py",
>> line 105, in body
>> extraHeadings=('Status',), extraJustifies=('left',))
>> File
>> "/home/magnusl/CCPN/ccpnmr/temporaryReleaseDir/ccpnmr/ccpnmr2.0/
>> python/memops/gui/FileSelect.py",
>> line 224, in __init__
>> File
>> "/home/magnusl/CCPN/ccpnmr/temporaryReleaseDir/ccpnmr/ccpnmr2.0/
>> python/memops/gui/FileSelect.py",
>> line 414, in updateFileList
>> File
>> "/home/magnusl/CCPN/ccpnmr/ccpnmr2.0/python/memops/gui/
>> ScrolledMatrix.py",
>> line 1921, in update
>> self.setGraphMenu()
>> File
>> "/home/magnusl/CCPN/ccpnmr/ccpnmr2.0/python/memops/gui/
>> ScrolledMatrix.py",
>> line 434, in setGraphMenu
>> options = self.getGraphMenuOptions()
>> File
>> "/home/magnusl/CCPN/ccpnmr/ccpnmr2.0/python/memops/gui/
>> ScrolledMatrix.py",
>> line 484, in getGraphMenuOptions
>> submenu.setMenuItems(items)
>> File
>> "/home/magnusl/CCPN/ccpnmr/temporaryReleaseDir/ccpnmr/ccpnmr2.0/
>> python/memops/gui/Menu.py",
>> line 114, in setMenuItems
>> File
>> "/home/magnusl/CCPN/ccpnmr/temporaryReleaseDir/ccpnmr/ccpnmr2.0/
>> python/memops/gui/Menu.py",
>> line 127, in deleteMenuItems
>> File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 2683, in delete
>> if c in self._tclCommands:
>> TypeError: argument of type 'NoneType' is not iterable
>>
>>
>> This one comes when I try to open the Open Project window and then I
>> cannot do anything from that window. I get a similar error when
>> opening
>> some other windows.
>>
>> I have just noticed these errors recently, but I am not sure if it is
>> anything that is wrong in the CCPN code or if it has to do with a
>> reasonably recent system update.
>>
>> Best Regards
>> /Magnus
>>
>> --
>> Magnus Lundborg, ph.D. Student
>> Stockholm University
>> Department of Organic Chemistry
>> Arrhenius Laboratory
>> S-106 91 Stockholm
>> Sweden
>> E-mail address: [log in to unmask]
> <broken2.6_tkinter_patch.diff>
Daniel O'Donovan
[log in to unmask]
|