TabViewer/tabview

tabview fails to open files with windows' new lines

Closed this issue · 5 comments

If I try to open a file with new lines as created by Excel, the program fails with this traceback:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/bin/tabview", line 100, in <module>
    column_width=args.width, double_width=args.double_width)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tabview/tabview.py", line 1241, in view
    buf = process_data(new_data, enc)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tabview/tabview.py", line 1093, in process_data
    for row in csv_obj:
_csv.Error: new-line character seen in unquoted field - do you need to open the file in universal-newline mode?

For an example try opening this file:
http://cl.ly/text/1c400L1T1U3U

Ah, oops. I need to figure out how to either enable the universal newlines while still maintaining our Python2/3 Unicode compatibility, or converting/filtering the newlines early on. Thanks for the report!

No problem! Yeah, it's a bit of a pain to maintain compatibility for all
these special cases!

On (Jul-13-15|20:55), Scott Hansen wrote:

Ah, oops. I need to figure out how to either enable the universal newlines while still maintaining our Python2/3 Unicode compatibility, or converting/filtering the newlines early on. Thanks for the report!


Reply to this email directly or view it on GitHub:
#122 (comment)

Can you please try the win_newlines branch? All the tests pass with your provided sample, but if you've got some other similar files please test with those as well!

Thanks,
Scott

I tried a few examples with that branch and it works great!! Thanks a
lot for having a look at this!

On (Jul-19-15|16:08), Scott Hansen wrote:

Can you please try the win_newlines branch? All the tests pass with your provided sample, but if you've got some other similar files please test with those as well!

Thanks,
Scott


Reply to this email directly or view it on GitHub:
#122 (comment)

Superb, thanks a bunch @firecat53