copied bit of error handling from Carl

This commit is contained in:
steffen123 2010-07-07 08:17:18 +02:00
parent 0ecd19fbdf
commit 1bf3827921

View File

@ -30,12 +30,14 @@ def splitPokerStarsSummaries(emailText):
return splitSummaries
#end def emailText
if __name__ == '__main__':
#TODO: move all these into the config file. until then usage is: ./ImapSummaries.py YourImapHost YourImapUser YourImapPw
configHost=sys.argv[1]
configUser=sys.argv[2]
configPw=sys.argv[3]
#TODO: specify folder, whether to use SSL
try:
server = IMAP4_SSL(configHost) #TODO: optionally non-SSL
response = server.login(configUser, configPw) #TODO catch authentication error
#print "response to logging in:",response
@ -71,5 +73,10 @@ for messageData in neededMessages:
#TODO: count results and output to shell like hand importer does
print "completed running Imap import, closing server connection"
finally:
try:
server.close()
finally:
pass
server.logout()