File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 55"""
66
77from roundup .i18n import _
8+ from cStringIO import StringIO
89error = """Sorry, you need a module compatible with the csv module.
910Either upgrade your Python to 2.3 or later, or get and install
1011the csv module from:
1516try :
1617 import csv
1718 try :
18- reader = csv .reader
19+ _reader = csv .reader
1920 writer = csv .writer
2021 excel = csv .excel
2122 error = ''
@@ -25,7 +26,7 @@ class excel:
2526 pass
2627 if hasattr (csv , 'parser' ):
2728 error = ''
28- def reader (fileobj , dialect = excel ):
29+ def _reader (fileobj , dialect = excel ):
2930 # note real readers take an iterable but 2.1 doesn't
3031 # support iterable access to file objects.
3132 result = []
@@ -63,6 +64,9 @@ class colon_separated(excel):
6364class comma_separated (excel ):
6465 delimiter = ','
6566
67+ def reader (fileobject , dialect = excel ):
68+ csv_lines = [line for line in fileobject .readlines () if line .strip ()]
69+ return _reader (StringIO ('' .join (csv_lines )), dialect )
6670
6771if __name__ == "__main__" :
6872 f = open ('testme.txt' , 'r' )
You can’t perform that action at this time.
0 commit comments