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

pa-philadelphia María Quiñones-Sánchez page contains unicode chars #4

Closed
rchekaluk opened this issue Sep 10, 2013 · 7 comments
Closed
Assignees

Comments

@rchekaluk
Copy link

Similar to opengovernment/opengovernment-local#9

Error is generated when scraping:

saving Councilmember O'Brien 522f2ce812a96023f0e70e95
saving Councilmember Oh 522f2ce812a96023f0e70e96
saving Councilmember O'Neill 522f2ce812a96023f0e70e97
saving Traceback (most recent call last):
  File "./import.py", line 89, in <module>
    print 'saving', member['Person Name'], council_member_id
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position 17: ordinal not in range(128)
@ghost ghost assigned derekeder Sep 12, 2013
@walter
Copy link

walter commented Sep 12, 2013

@derekeder can you take a look at this ASAP, please. This is blocking us for a server set up.

@derekeder
Copy link
Contributor

@rchekaluk could you post a full traceback for this error?

@derekeder
Copy link
Contributor

@rchekaluk actually, it looks like an error with the print statement. Will push up a fix shortly.

print str.decode('utf-8')

@derekeder
Copy link
Contributor

fixed with 65c4495

@rchekaluk give it another try

@rchekaluk
Copy link
Author

Typo, this fix fails per below. I think you meant "encode" not "decode" (see opengovernment/opengovernment-local#9 (comment)); I experimented with "encode" manually and it resolved the issue.

saving Councilmember O'Brien 5232113d12a96075ffde86c7
saving Councilmember Oh 5232113d12a96075ffde86c8
saving Councilmember O'Neill 5232113d12a96075ffde86c9
saving
Traceback (most recent call last):
  File "/u/apps/legistar-scrape-staging/import.py", line 89, in <module>
    print 'saving', member['Person Name'].decode('utf-8'), council_member_id
  File "/u/apps/virtualenvs/legistar/lib64/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position 17: ordinal not in range(128)

@derekeder
Copy link
Contributor

@rchekaluk hmm strange. not quite sure why that worked. uploaded a fix with encode 22495fe

@rchekaluk
Copy link
Author

Success, thx.

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

3 participants