Browse files

Fix for the fact that some versions of the csv module (apparently

including some bundled with pypy) misspell the word "larger" as
"larget". This fixes one pypy test failure mentioned in GH-165.
  • Loading branch information...
1 parent 5e3b271 commit 1ad45af4d09227debaf13f2cf62ed5edcbd8f3e0 @msabramo msabramo committed May 11, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 csvkit/unicsv.py
View
3 csvkit/unicsv.py
@@ -6,6 +6,7 @@
import codecs
import csv
+import fnmatch
from cStringIO import StringIO
from csvkit.exceptions import FieldSizeLimitError
@@ -40,7 +41,7 @@ def next(self):
row = self.reader.next()
except csv.Error, e:
# Terrible way to test for this exception, but there is no subclass
- if 'field larger than field limit' in str(e):
+ if fnmatch.fnmatch(str(e), 'field large[rt] than field limit *'):
raise FieldSizeLimitError(csv.field_size_limit())
else:
raise e

0 comments on commit 1ad45af

Please sign in to comment.