Hello there,

I have the same problem when trying to start skencil, I'm pasting the
backtrace here for your reference:

Traceback (most recent call last):
  File "/usr/bin/skencil", line 34, in <module>
    Sketch.main.main()
  File "/usr/lib/skencil/Sketch/Base/main.py", line 148, in main
    run_script = options.run_script)
  File "/usr/lib/skencil/Sketch/UI/skapp.py", line 183, in __init__
    self.build_window()
  File "/usr/lib/skencil/Sketch/UI/skapp.py", line 223, in build_window
    self.run_script)
  File "/usr/lib/skencil/Sketch/UI/mainwindow.py", line 98, in __init__
    self.build_menu()
  File "/usr/lib/skencil/Sketch/UI/mainwindow.py", line 901, in build_menu
    self.update_mru_files()
  File "/usr/lib/skencil/Sketch/UI/mainwindow.py", line 380, in update_mru_files
    self.file_menu.RebuildMenu()
  File "/usr/lib/skencil/Sketch/UI/tkext.py", line 367, in RebuildMenu
    self.menu.delete(0, END)
  File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 2678, in delete
    self.deletecommand(c)
  File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 361, in deletecommand
    self.tk.deletecommand(name)
TclError: can't delete Tcl command

I made a temporary fix that just ignores the exception -- catches it
at the last point in the sketch sources so it won't shutdown the
application.
Even with this fix, the File menu looks really strange. Because the
deletecommand doesn't work, the file menu is repeated 3 times (you
have all the options from the menu, then again all the options two
more times).

The patch is attached. To apply it, do something like this:
sudo patch /usr/lib/skencil/Sketch/UI/tkext.py <
skencil-deletecommand-tmpfix.patch

----

For devs:

I added some debug output in /usr/lib/python2.6/lib-tk/Tkinter.py in
Menu.delete to see what happens.

My conclusion is that some commands from the file menu (only sure
about the New command, that's the one that triggers the bug) are given
as python callbacks and lib-tk doesn't seem to support them properly
(the delete method takes two indexes and tries to get the names of the
commands for all the items in that range -- specifically, the
'command' attribute, which should be a string but in this case it's a
tuple).

Here's what I get with debug stuff added:

DEBUG: self.entryconfig( 1 ):  {'foreground': ('foreground', '', '',
'', ''), 'accelerator': ('accelerator', '', '', '', ''), 'hidemargin':
('hidemargin', '', '', '0', '0'), 'label': ('label', '', '', '',
'New'), 'underline': ('underline', '', '', '-1', '-1'), 'bitmap':
('bitmap', '', '', '', ''), 'columnbreak': ('columnbreak', '', '',
'0', '0'), 'state': ('state', '', '', 'normal', 'normal'), 'command':
('command', '', '', '', ('call_py_method', '140135010609848',
'Invoke')), 'background': ('background', '', '', '', ''), 'compound':
('compound', 'compound', 'Compound', 'none', 'none'), 'font': ('font',
'', '', '', ''), 'image': ('image', '', '', '', ''),
'activeforeground': ('activeforeground', '', '', '', ''),
'activebackground': ('activebackground', '', '', '', '')}
DEBUG: self.entrycget( 1 ):  call_py_method 140135010609848 Invoke
- Tkinter: deleted command call_py_method 140135010609848 Invoke
Delete failed (bug #524554)
Traceback (most recent call last):
  File "/usr/lib/skencil/Sketch/UI/tkext.py", line 368, in RebuildMenu
    self.menu.delete(0, END)
  File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 2680, in delete
    self.deletecommand(c)
  File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 361, in
deletecommand
    self.tk.deletecommand(name)
TclError: can't delete Tcl command


Hope this helps. I could run more tests or add more debug output if
you need it, but I have to say it: as a first impression, I really
hate tcl/tk :)


--
Octavian Voicu
--- /usr/lib/skencil/Sketch/UI/tkext.py.bak	2009-07-11 21:07:42.275535338 +0300
+++ /usr/lib/skencil/Sketch/UI/tkext.py	2009-07-11 22:25:49.591327355 +0300
@@ -364,7 +364,10 @@
 
     def RebuildMenu(self):
 	if self.entries is not None:
-	    self.menu.delete(0, END)
+	    try:
+		self.menu.delete(0, END)
+	    except:
+		warn_tb(INTERNAL, 'Delete failed (bug #524554)')
 	if self.rebuild_func is not None:
 	    try:
 		self.entries = self.rebuild_func()

Reply via email to