I'm trying to use Halo in a CLI that can be called from a terminal directly or from a CI, when I try to redirect the stdout to a file I have this exception.
It works perfectly in the terminal but when I try to redirect the stdout to a file, it raise an exception.
e.g.:
$ ./my_example_cli_task.py > cli.log
System settings
Operating System: Ubuntu 18.04.1 LTS
Terminal in use: NA
Python version: Python 2.7.15rc1
Halo version: 0.0.21
pip freeze output:
Error
Traceback (most recent call last):
File "test.py", line 7, in <module>
spin.start(text="Starting")
File "/home/agustin/git/halo/halo/halo.py", line 423, in start
self._render_frame()
File "/home/agustin/git/halo/halo/halo.py", line 341, in _render_frame
self._stream.write(output)
File "/usr/local/lib/python2.7/dist-packages/colorama/ansitowin32.py", line 40, in write
self.__convertor.write(text)
File "/usr/local/lib/python2.7/dist-packages/colorama/ansitowin32.py", line 141, in write
self.write_and_convert(text)
File "/usr/local/lib/python2.7/dist-packages/colorama/ansitowin32.py", line 166, in write_and_convert
self.write_plain_text(text, cursor, start)
File "/usr/local/lib/python2.7/dist-packages/colorama/ansitowin32.py", line 174, in write_plain_text
self.wrapped.write(text[start:end])
File "/usr/local/lib/python2.7/dist-packages/colorama/ansitowin32.py", line 40, in write
self.__convertor.write(text)
File "/usr/local/lib/python2.7/dist-packages/colorama/ansitowin32.py", line 141, in write
self.write_and_convert(text)
File "/usr/local/lib/python2.7/dist-packages/colorama/ansitowin32.py", line 169, in write_and_convert
self.write_plain_text(text, cursor, len(text))
File "/usr/local/lib/python2.7/dist-packages/colorama/ansitowin32.py", line 174, in write_plain_text
self.wrapped.write(text[start:end])
UnicodeEncodeError: 'ascii' codec can't encode character u'\u280b' in position 0: ordinal not in range(128)
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/home/agustin/git/halo/halo/halo.py", line 81, in clean_up
self.stop()
File "/home/agustin/git/halo/halo/halo.py", line 440, in stop
self._spinner_thread.join()
File "/usr/lib/python2.7/threading.py", line 929, in join
raise RuntimeError("cannot join thread before it is started")
RuntimeError: cannot join thread before it is started
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/home/agustin/git/halo/halo/halo.py", line 81, in clean_up
self.stop()
File "/home/agustin/git/halo/halo/halo.py", line 440, in stop
self._spinner_thread.join()
File "/usr/lib/python2.7/threading.py", line 929, in join
raise RuntimeError("cannot join thread before it is started")
RuntimeError: cannot join thread before it is started
Description
I'm trying to use Halo in a CLI that can be called from a terminal directly or from a CI, when I try to redirect the stdout to a file I have this exception.
Example:
It works perfectly in the terminal but when I try to redirect the stdout to a file, it raise an exception. e.g.:
System settings
pip freeze
output:Error
Expected behaviour
Print the my CLI log to a file
Steps to recreate
Redirect the stdout to file
People to notify
@alarreine