taraslayshchuk / es2csv

Export from an Elasticsearch into a CSV file
Apache License 2.0
510 stars 191 forks source link

'unicode' is not defined #39

Closed nthx closed 6 years ago

nthx commented 6 years ago

I've just downloaded & run it on debian and it gives me this:

  File "/usr/local/lib/python3.4/dist-packages/es2csv.py", line 237, in <dictcomp>
    line_dict_utf8 = {k: v.encode('utf8') if isinstance(v, unicode) else v for k, v in line_as_dict.items()}
NameError: name 'unicode' is not defined

I've hacked the file and modified unicode -> str and it worked

Hope it helps..

jayjanssen commented 6 years ago

ditto, thanks for the quick hack @nthx

jayjanssen commented 6 years ago

This is actually an issue if you use python3. Python2 doesn't have this issue. With P3, I got my strings outputted as byte characters, e.g., "b'some string'", which was undesirable for me.

taraslayshchuk commented 6 years ago

Please use python2, python3 not supported yet.