learntextvis / textkit

Command line tool for manipulating and analyzing text
MIT License
28 stars 6 forks source link

Bug with error def? #5

Closed arnicas closed 8 years ago

arnicas commented 8 years ago

textkit text2words dem_debate_2015_10_13_wapo.txt | textkit filterpunc - | textkit count - | head

got top words, but it ended: Traceback (most recent call last): File "/Users/lynn/miniconda/envs/textvis/bin/textkit", line 9, in load_entry_point('textkit', 'console_scripts', 'textkit')() File "/Users/lynn/miniconda/envs/textvis/lib/python2.7/site-packages/click/core.py", line 716, in call return self.main(_args, _kwargs) File "/Users/lynn/miniconda/envs/textvis/lib/python2.7/site-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/Users/lynn/miniconda/envs/textvis/lib/python2.7/site-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/lynn/miniconda/envs/textvis/lib/python2.7/site-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, _ctx.params) File "/Users/lynn/miniconda/envs/textvis/lib/python2.7/site-packages/click/core.py", line 534, in invoke return callback(_args, **kwargs) File "/Users/lynn/Documents/My Talks and Courses/LearnTextVis/textkit/textkit/stats/count_tokens.py", line 16, in count_tokens [output(sep.join(map(str, vals))) for vals in counts] File "/Users/lynn/Documents/My Talks and Courses/LearnTextVis/textkit/textkit/utils.py", line 14, in output except (BrokenPipeError, IOError): NameError: global name 'BrokenPipeError' is not defined

vlandham commented 8 years ago

This looks to be because BrokenPipeError is a python 3 only error... as the entire error hierarchy has changed: https://docs.python.org/3/library/exceptions.html

I've switched this to an OSError handler. in 06e5c856be8f01a54609b5bc2ca958a49847df62

Can you see if that fixes the problem?

arnicas commented 8 years ago

It works with python 2.7. I didn't test with 3 as well. but yay!

vlandham commented 8 years ago

i believe this is fixed now.