sharat87 / ti

A simple command line time tracker.
http://ti.sharats.me
122 stars 68 forks source link

ti log crashes with pipe #18

Open francoisbeaulieu opened 9 years ago

francoisbeaulieu commented 9 years ago

Hi,

Any idea why 'ti log' would crash anytime you try to pipe the output to another command? I'm running Python2.7 on Mac OSX Yosemite.

Output:

% ti log | grep PCO Traceback (most recent call last): File "/usr/local/bin/ti", line 434, in main() File "/usr/local/bin/ti", line 426, in main fn(**args) File "/usr/local/bin/ti", line 235, in action_log end=' ← working\n' if current == name else '\n') UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-2: ordinal not in range(128)

MattHulse commented 9 years ago

Submitted pull request #19. For some reason when the output is piped, the unicode character '←' isn't being encoded properly. You could just convert that character to ascii (<--) or add the explicit encode after the string: '← working\n'.encode('utf-8')

francoisbeaulieu commented 9 years ago

The committed patch does appear to fix my issue. Thanks!