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

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

Open
skhani opened this issue Jun 19, 2014 · 14 comments

Comments

@skhani
Copy link

skhani commented Jun 19, 2014

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

+1 :)

@realyze
Copy link

realyze commented Aug 30, 2014

+1

2 similar comments
@chojnac
Copy link

chojnac commented Sep 13, 2014

+1

@bobhobelman
Copy link

+1

@jtushman
Copy link
Owner

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

@Holek
Copy link

Holek commented Nov 6, 2014

+1 ?

@charlieanstey
Copy link

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

noop commented Jan 21, 2015

+1

@jtushman jtushman reopened this Jan 21, 2015
@PierrePaul
Copy link

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

👍 😕

@zeke
Copy link

zeke commented Jul 27, 2015

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

Created a PR based on @PierrePaul's fix.

@LorenDavie
Copy link

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

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

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

No branches or pull requests

16 participants