pivotal_tools icon indicating copy to clipboard operation
pivotal_tools copied to clipboard

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

Open skhani opened this issue 10 years ago • 14 comments

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)

skhani avatar Jun 19 '14 15:06 skhani

+1 :)

jarod51 avatar Aug 01 '14 09:08 jarod51

+1

realyze avatar Aug 30 '14 13:08 realyze

+1

chojnac avatar Sep 13 '14 14:09 chojnac

+1

bobhobelman avatar Oct 20 '14 07:10 bobhobelman

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

jtushman avatar Oct 20 '14 14:10 jtushman

+1 ?

Holek avatar Nov 06 '14 12:11 Holek

+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

charlieanstey avatar Jan 14 '15 09:01 charlieanstey

+1

noop avatar Jan 21 '15 15:01 noop

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'))

PierrePaul avatar Jan 22 '15 17:01 PierrePaul

:+1: :confused:

Dangeranger avatar Apr 23 '15 21:04 Dangeranger

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)

zeke avatar Jul 27 '15 05:07 zeke

Created a PR based on @PierrePaul's fix.

BryanSaxon avatar Aug 24 '15 17:08 BryanSaxon

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?

LorenDavie avatar Apr 20 '16 18:04 LorenDavie

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

rpdelaney avatar Nov 21 '18 22:11 rpdelaney