Permalink
Browse files

Fixed a bug, and now print with unexpected exception the full trace

  • Loading branch information...
1 parent 31a0f80 commit 126fd4749768cec30ea4fea9723666af858c9e0a @ik5 committed Feb 6, 2013
Showing with 6 additions and 4 deletions.
  1. +6 −4 convert_quotes.py
View
@@ -8,6 +8,7 @@
import fdb
import logging
import atexit
+import traceback
def init_logger() :
"""initialize the logger"""
@@ -223,7 +224,9 @@ def run(con, logger = LOGGER) :
LOGGER.debug('Starting to parse file:')
- counter = 0
+ counter = 0
+ authors_ids = {}
+
for quote, author in iter_quotes():
if not insert_to_db(con, quote, author, authors_ids) :
logger.critical('Could not insert quote ("%s") to database', quote)
@@ -251,10 +254,9 @@ def run(con, logger = LOGGER) :
try :
run(con)
- except :
+ except Exception as e:
LOGGER.critical('Unexpected exception was raised: %s',
- sys.exc_info()[0])
+ traceback.format_exc(e))
- finalize(con)
sys.exit()

0 comments on commit 126fd47

Please sign in to comment.