diff options
Diffstat (limited to 'bin/update')
-rwxr-xr-x | bin/update | 31 |
1 files changed, 20 insertions, 11 deletions
@@ -1,6 +1,6 @@ #! @PYTHON@ # -# Copyright (C) 1998-2004 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2005 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -431,16 +431,21 @@ def update_qfiles(): # The files in qfiles/bad can't possibly be pickles continue sb = Switchboard(dirpath) - for filename in os.listdir(dirpath): - filepath = os.path.join(dirpath, filename) - filebase, ext = os.path.splitext(filepath) - # Handle the .db metadata files as part of the handling of the - # .pck or .msg message files. - if ext not in ('.pck', '.msg'): - continue - msg, data = dequeue(filebase) - if msg is not None and data is not None: - sb.enqueue(msg, data) + try: + for filename in os.listdir(dirpath): + filepath = os.path.join(dirpath, filename) + filebase, ext = os.path.splitext(filepath) + # Handle the .db metadata files as part of the handling of the + # .pck or .msg message files. + if ext not in ('.pck', '.msg'): + continue + msg, data = dequeue(filebase) + if msg is not None and data is not None: + sb.enqueue(msg, data) + except EnvironmentError, e: + if e.errno <> errno.ENOTDIR: + raise + print _('Warning! Not a directory: %(dirpath)s') @@ -521,6 +526,10 @@ def dequeue(filebase): else: os.unlink(msgfile) msg = data = None + except EOFError: + # For some reason the pckfile was empty. Just delete it. + print _('Warning! Deleting empty .pck file: %(pckfile)s') + os.unlink(pckfile) finally: if msgfp: msgfp.close() |