def archiveYahooMessage(file, archiveFile, messageYear, format): try: f = open(archiveFile, 'a') if f.tell() == 0: f.write("\n"); f.write(loadYahooMessage(file, format)) f.close() print ('Yahoo Message: ' + file + ' archived to: archive-' + str(messageYear) + '.html') except Exception as e: print ('Yahoo Message: ' + file + ' had an error:') print (e)