Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error executing on windows #4

Open
acnazarejr opened this issue Jun 17, 2017 · 2 comments
Open

Error executing on windows #4

acnazarejr opened this issue Jun 17, 2017 · 2 comments
Assignees
Labels

Comments

@acnazarejr
Copy link

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
Copy link
Owner

nirum commented Jun 17, 2017

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!

@nirum nirum self-assigned this Jun 17, 2017
@nirum nirum added the bug label Jun 17, 2017
@tintinweb
Copy link

hey @nirum, I am thinking about using your lib to print tables on a windows application and I am encountering the same problem. any update here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants