You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.
perhaps this post may be useful to you: http://forum.kodi.tv/showthread.php?tid=144677
it explains how to properly handle/avoid unicode errors.
there's an example log function at the bottom of the post, which i've been using in all my addons for years now, and never had an issue with it.
Let's talk about it, as I feel the try/except is way more pythonic then the one solution named in the forum
The text was updated successfully, but these errors were encountered:
the issue is not try-except itself, especially since python is more follows EAFP idiom ("Easier to ask for forgiveness than permission")
The issue is that this special case shows that the dev does not know when some object is unicode type or string type.
Best practice is to convert any data coming into application into unicode so that internally everything is handled as unicode. That way this specific try-except handling is not needed.
Yes, I would prefer that in a perfect world. The problem with that is, that we can't make sure of that via our boilerplate. But what we can do is handling it gracefully when it happens.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
As raised in #6 (review)
Phil said this code smells as if something is done wrongly.
Ronie said
Let's talk about it, as I feel the try/except is way more pythonic then the one solution named in the forum
The text was updated successfully, but these errors were encountered: