diff --git a/edx/analytics/tasks/export/database_exports.py b/edx/analytics/tasks/export/database_exports.py index 3846ae591..29773a82f 100644 --- a/edx/analytics/tasks/export/database_exports.py +++ b/edx/analytics/tasks/export/database_exports.py @@ -76,7 +76,12 @@ def mapper(self, line): key: course_id value: tab separated row data """ - values = csv_util.parse_line(line, dialect='mysqldump') + try: + values = csv_util.parse_line(line, dialect='mysqldump') + except csv.Error: + log.error('Error parsing line: %s', line) + print('Error parsing line: %s' % line) + raise record = StudentModuleRecord(*values) course_id = record.course_id diff --git a/edx/analytics/tasks/util/csv_util.py b/edx/analytics/tasks/util/csv_util.py index 408082b0e..66cc7cf39 100644 --- a/edx/analytics/tasks/util/csv_util.py +++ b/edx/analytics/tasks/util/csv_util.py @@ -54,7 +54,11 @@ class MySQLExportDialect(MySQLPipeDialect): def parse_line(line, dialect='excel'): """Parse one line of CSV in the dialect specified.""" # csv.reader requires an iterable per row, so we wrap the line in a list - parsed = csv.reader([line], dialect=dialect).next() + try: + parsed = csv.reader([line], dialect=dialect).next() + except csv.Error: + log.error('Error parsing line: %s', line) + raise return parsed