ickc / pantable

CSV Tables in Markdown: Pandoc Filter for CSV Tables
https://ickc.github.io/pantable/
BSD 3-Clause "New" or "Revised" License
86 stars 15 forks source link

Doesn't like non-ascii characters #12

Closed lyndondrake closed 7 years ago

lyndondrake commented 7 years ago

Hi,

I've got a csv file that works fine with csv2table, but for which pantable throws this error:

pantable: table rows are of irregular length. Empty cells appended. Traceback (most recent call last): File "/usr/local/bin/pantable", line 11, in sys.exit(main()) File "/usr/local/lib/python2.7/site-packages/pantable/pantable.py", line 320, in main strict_yaml=True File "/usr/local/lib/python2.7/site-packages/panflute/io.py", line 265, in run_filter return run_filters([action], *args, **kwargs) File "/usr/local/lib/python2.7/site-packages/panflute/io.py", line 246, in run_filters doc = doc.walk(action, doc) File "/usr/local/lib/python2.7/site-packages/panflute/base.py", line 274, in walk ans = list(chain.from_iterable(ans)) File "/usr/local/lib/python2.7/site-packages/panflute/base.py", line 272, in ans = ((item,) if type(item) != list else item for item in ans) File "/usr/local/lib/python2.7/site-packages/panflute/base.py", line 269, in ans = (item.walk(action, doc) for item in obj) File "/usr/local/lib/python2.7/site-packages/panflute/base.py", line 285, in walk altered = action(self, doc) File "/usr/local/lib/python2.7/site-packages/panflute/tools.py", line 164, in yaml_filter element=element, doc=doc) File "/usr/local/lib/python2.7/site-packages/pantable/pantable.py", line 279, in convert2table options), number_of_columns, table_list) File "/usr/local/lib/python2.7/site-packages/pantable/pantable.py", line 135, in auto_width ) for column_index in range(number_of_columns)] UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 23: ordinal not in range(128) pandoc: Error running filter pantable Filter returned error status 1

any idea how to fix it?

Cheers, Lyndon

lyndondrake commented 7 years ago

Apologies, realised that this was just because I had python2 as the default interpreter. Python3 works fine.