X-Git-Url: http://git.veekun.com/zzz-pokedex.git/blobdiff_plain/f612f0704952532a19e3eb49fcd862c49afa1489..e2e45180d48996e7ca45214b397845d843bb7889:/pokedex/__init__.py diff --git a/pokedex/__init__.py b/pokedex/__init__.py index 8437ce4..e142ae6 100644 --- a/pokedex/__init__.py +++ b/pokedex/__init__.py @@ -104,7 +104,7 @@ def command_csvimport(engine_uri, directory='.'): try: session.add(row) session.flush() - except IntegrityError as e: + except IntegrityError, e: failed_rows.append(row) # Loop over the failed rows and keep trying to insert them. If a loop @@ -121,7 +121,7 @@ def command_csvimport(engine_uri, directory='.'): # Success! del failed_rows[i] do_another_loop = True - except IntegrityError as e: + except IntegrityError, e: pass if failed_rows: @@ -187,6 +187,6 @@ def command_help(): csvexport {uri} [dir] Export data from the database given by the URI to a set of CSVs. Directory defaults to cwd. -""" +""".encode(sys.getdefaultencoding(), 'replace') sys.exit(0)