Error executing on windows
acnazarejr opened this issue · 2 comments
acnazarejr commented
I try this:
import tableprint as tp
tp.banner('test')
error:
Traceback (most recent call last):
File "stats.py", line 83, in <module>
main()
File "C:\Users\acnazarejr\Anaconda3\envs\harhealth-sensors\lib\site-packages\click\core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "C:\Users\acnazarejr\Anaconda3\envs\harhealth-sensors\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "C:\Users\acnazarejr\Anaconda3\envs\harhealth-sensors\lib\site-packages\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\acnazarejr\Anaconda3\envs\harhealth-sensors\lib\site-packages\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\acnazarejr\Anaconda3\envs\harhealth-sensors\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "stats.py", line 40, in dataset
tp.banner('title_text')
File "C:\Users\acnazarejr\Anaconda3\envs\harhealth-sensors\lib\site-packages\tableprint\printer.py", line 259, in banner
out.write(header([message], max(width, len(message)), style) + '\n')
File "C:\Users\acnazarejr\Anaconda3\envs\harhealth-sensors\lib\site-packages\colorama\ansitowin32.py", line 40, in write
self.__convertor.write(text)
File "C:\Users\acnazarejr\Anaconda3\envs\harhealth-sensors\lib\site-packages\colorama\ansitowin32.py", line 141, in write
self.write_and_convert(text)
File "C:\Users\acnazarejr\Anaconda3\envs\harhealth-sensors\lib\site-packages\colorama\ansitowin32.py", line 169, in write_and_convert
self.write_plain_text(text, cursor, len(text))
File "C:\Users\acnazarejr\Anaconda3\envs\harhealth-sensors\lib\site-packages\colorama\ansitowin32.py", line 174, in write_plain_text
self.wrapped.write(text[start:end])
File "C:\Users\acnazarejr\Anaconda3\envs\harhealth-sensors\lib\site-packages\colorama\ansitowin32.py", line 40, in write
self.__convertor.write(text)
File "C:\Users\acnazarejr\Anaconda3\envs\harhealth-sensors\lib\site-packages\colorama\ansitowin32.py", line 141, in write
self.write_and_convert(text)
File "C:\Users\acnazarejr\Anaconda3\envs\harhealth-sensors\lib\site-packages\colorama\ansitowin32.py", line 169, in write_and_convert
self.write_plain_text(text, cursor, len(text))
File "C:\Users\acnazarejr\Anaconda3\envs\harhealth-sensors\lib\site-packages\colorama\ansitowin32.py", line 174, in write_plain_text
self.wrapped.write(text[start:end])
File "C:\Users\acnazarejr\Anaconda3\envs\harhealth-sensors\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-31: character maps to <undefined>
Python version: 3.5.3
OS: Windows 10
nirum commented
Hi, thanks for bringing this up! I unfortunately haven't tested tableprint on windows and was unaware of this problem. It looks like there is a simple solution (I just need to add a .encode('utf-8')
to a string before printing it, but I will double check and get back to you!