Dictionary assignment

Mark Daley mark at diversiform.com
Fri Aug 15 16:40:07 EDT 2003


I've been using this to save one dictionary as an entry in another
dictionary.  I was working, but now it seems I've done something to break
it.  Here's the code in question:

 def formatsave(self, args = None):
      if self.formats.get() == '':
           tkMessageBox.showwarning("No Format", "You must specify a format
name.")
      else:
           for key in current.keys():
                format[self.formats.get()][key] = current[key]
           temp = format.keys()
           temp.sort()
           list = tuple(temp)
           gui.formats._list.setlist(list)


Here's the error I'm getting:

Traceback (most recent call last):
      File "C:\PYTHON23\lib\lib-tk\Tkinter.py", line 1345, in __call__
        return self.func(*args)
      File "C:\Python23\Layout.py", line 191, in formatsave
        format[self.formats.get()][key] = current[key]
KeyError: 'Format 1'


Any ideas?

- Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20030815/8b198d95/attachment.html>


More information about the Python-list mailing list