pypingou / fedora-active-user

Reports the recent activity of a Fedora contributor
23 stars 13 forks source link

ERROR:active-user:'ascii' codec can't encode character u'\u010d' in position 9: ordinal not in range(128) #4

Closed hroncok closed 9 years ago

hroncok commented 9 years ago
+ ./fedora_active_user.py --email mhroncok@redhat.com
Last email on mailing list:
   2015-05-18 gmane.linux.redhat.fedora.devel
   No activity found on gmane.linux.redhat.fedora.artwork
   No activity found on gmane.linux.redhat.fedora.desktop
   2014-01-16 gmane.linux.redhat.fedora.epel.devel
   2015-02-01 gmane.linux.redhat.fedora.extras.packaging
   No activity found on gmane.linux.redhat.fedora.fonts
   No activity found on gmane.linux.redhat.fedora.general
   No activity found on gmane.linux.redhat.fedora.infrastructure
   No activity found on gmane.linux.redhat.fedora.kde
   2014-05-14 gmane.linux.redhat.fedora.perl
Bugzilla activity
   48 bugs assigned, cc or on which mhroncok@redhat.com commented
Last comment on the most recent ticket on bugzilla:
ERROR:active-user:'ascii' codec can't encode character u'\u010d' in position 9: ordinal not in range(128)

The character mentioned is č and I have that in my bugzilla name.

pypingou commented 9 years ago

but...but... you are still active ;-)

hroncok commented 9 years ago

I was just checking something.

pypingou commented 9 years ago

Yeah, thanks for the report :)

pypingou commented 9 years ago

Hm, trying to replicate it here:

$ ./fedora_active_user.py --email mhroncok@redhat.com --nolists
Bugzilla activity
   48 bugs assigned, cc or on which mhroncok@redhat.com commented
Last comment on the most recent ticket on bugzilla:
   #1250668 2015-08-06 mhroncok@redhat.com

with python-bugzilla-1.2.1-1.fc21.noarch

pypingou commented 9 years ago

Could you run it with --debug? This should give us a stacktrace to work on

hroncok commented 9 years ago
DEBUG:active-user:1250668
ERROR:active-user:'ascii' codec can't encode character u'\u010d' in position 9: ordinal not in range(128)
Traceback (most recent call last):
  File "./fedora_active_user.py", line 464, in main
    _get_bugzilla_history(args.email)
  File "./fedora_active_user.py", line 141, in _get_bugzilla_history
    last_com['author']))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u010d' in position 9: ordinal not in range(128)

python-bugzilla-1.2.1-1.fc21.noarch as well

hroncok commented 9 years ago

Adding u'' to the format string fixes the problem:

print(u'   #{0} {1} {2}'.format(
hroncok commented 9 years ago

BTW in your comment, the name is missing.

pypingou commented 9 years ago

Ok so the presence of the name or the email depends on if you are logged in on bugzilla via a ~/.bugzillatoken or a ~/.bugzillacookies (then you get the email), otherwise you get the name.

Indeed, using u'' fixes this, thanks!