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

Fix TypeError in str(TaskwarriorError(...)) #126

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion taskw/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ def __unicode__(self):
)

def __str__(self):
return self.__unicode__().encode(sys.getdefaultencoding(), 'replace')
return self.__unicode__().encode(sys.getdefaultencoding(), 'replace').decode(sys.getdefaultencoding())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just briefly glancing, I’m fairly sure this is here from when we were supporting Python 2.7 where this method had to return bytes (& I believe we’ve dropped that by now).

Rather than calling __unicode__, encoding to bytes, then decoding once again, we should really probably just move the contents of __unicode__ here and delete the __unicode__ method entirely.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI - did this as part of #149