jtushman / pivotal_tools

geeky command-line interface with additional scrum, planning poker, and changelog generation features
http://jtushman.github.io/blog/2013/08/15/introducing-pivotal-tools/
64 stars 26 forks source link

UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 8383: ordinal not in range(128) #16

Open skhani opened 10 years ago

skhani commented 10 years ago

when doing pivotal_tools scrum {number} i get this error

Traceback (most recent call last):
  File "/usr/local/bin/pivotal_tools", line 9, in <module>
    load_entry_point('pivotal-tools==0.14', 'console_scripts', 'pivotal_tools')()
  File "/usr/local/lib/python2.7/site-packages/pivotal_tools/cli.py", line 519, in main
    scrum(project)
  File "/usr/local/lib/python2.7/site-packages/pivotal_tools/cli.py", line 228, in scrum
    bugs = project.open_bugs()
  File "/usr/local/lib/python2.7/site-packages/pivotal_tools/pivotal.py", line 247, in open_bugs
    return self.get_stories('type:bug state:unstarted')
  File "/usr/local/lib/python2.7/site-packages/pivotal_tools/pivotal.py", line 219, in get_stories
    stories_root = ET.fromstring(response.text)
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1300, in XML
    parser.feed(text)
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1640, in feed
    self._parser.Parse(data, 0)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 8383: ordinal not in range(128)
arnaud-lecat commented 10 years ago

+1 :)

realyze commented 10 years ago

+1

chojnac commented 10 years ago

+1

bobhobelman commented 9 years ago

+1

jtushman commented 9 years ago

Hey guys -- anyone have a PR to fix this. Happy to merge it in.

Holek commented 9 years ago

+1 ?

charlieanstey commented 9 years ago

+1 Had the same issue with u'\u2019'. Is it just because an ASCII terminal is being used with Python. The pull request would need to filter/substitute non-ascii chars?

http://stackoverflow.com/questions/18473794/cant-print-character-u2019-in-python-from-json-object

noop commented 9 years ago

+1

PierrePaul commented 9 years ago

I had the same issue with accentuated characters.

I changed Line 196 : root = ET.fromstring(response.text.encode('ascii', 'ignore')) same thing with 219 : stories_root = ET.fromstring(response.text.encode('ascii', 'ignore'))

Dangeranger commented 9 years ago

:+1: :confused:

zeke commented 9 years ago

Similar error for me:

❯ pivotal_tools show stories
Select a Project:
[1] Josephine
[2] MyPetStore
>> 1
Traceback (most recent call last):
  File "/usr/local/bin/pivotal_tools", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/pivotal_tools/cli.py", line 512, in main
    show_stories(project, arguments)
  File "/usr/local/lib/python2.7/site-packages/pivotal_tools/cli.py", line 142, in show_stories
    stories = project.get_stories(search_string)
  File "/usr/local/lib/python2.7/site-packages/pivotal_tools/pivotal.py", line 219, in get_stories
    stories_root = ET.fromstring(response.text)
  File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1300, in XML
    parser.feed(text)
  File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1640, in feed
    self._parser.Parse(data, 0)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2191' in position 12543: ordinal not in range(128)
BryanSaxon commented 9 years ago

Created a PR based on @PierrePaul's fix.

LorenDavie commented 8 years ago

Hm. I just issued a PR for this, but I see there are several others that do the same thing. Is there an active fork of this project somewhere?

rpdelaney commented 5 years ago

Looks like this fork implemented python3 support with backward compatibility, which solves a lot of issues: https://github.com/jtushman/pivotal_tools