kuruoujou / XBMal

XBMal - the XBMC MAL Plugin. Update your MyAnimeList based on your XBMC Library!
GNU General Public License v3.0
10 stars 4 forks source link

UnicodeEncodeError in xbmc.log #15

Closed wolfgame closed 9 years ago

wolfgame commented 9 years ago

Figured I'd check out the current version to see if the issues had been worked out and am receiving the following error. Is this project still active?

05:44:18 T:10588   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.UnicodeEncodeError'>
                                            Error Contents: 'ascii' codec can't encode character u'\xa0' in position 29: ordinal not in range(128)
                                            Traceback (most recent call last):
                                              File "C:\Users\Bill\AppData\Roaming\XBMC\addons\script.service.xbmal\default.py", line 215, in <module>
                                                w = MainDiag()
                                              File "C:\Users\Bill\AppData\Roaming\XBMC\addons\script.service.xbmal\default.py", line 163, in __init__
                                                mappings = lg.generateList(pDialog)
                                              File "C:\Users\Bill\AppData\Roaming\XBMC\addons\script.service.xbmal\default.py", line 49, in generateList
                                                self.output.log("Checking " + season[0]['showtitle'] + " Season " + str(season[0]['season']), xbmc.LOGNOTICE)
                                              File "C:\Users\Bill\AppData\Roaming\XBMC\addons\script.service.xbmal\resources\lib\xbmal.py", line 133, in log
                                                xbmc.log("### [%s] - %s" %(__scriptname__,msg), level=loglevel)
                                            UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 29: ordinal not in range(128)
                                            -->End of Python script error report<--
05:44:18 T:11528   DEBUG: ------ Window Init (DialogKaiToast.xml) ------
05:44:18 T:10588    INFO: Python script stopped
kuruoujou commented 9 years ago

Activeish. I'm working on migrating to Plex from XBMC, but I'll continue to provide bug fixes and the like until I find a developer to take over.

As for your error, for a quick workaround, you can comment out line 133 in the file "C:\Users\Bill\AppData\Roaming\XBMC\addons\script.service.xbmal\resources\lib\xbmal.py", and that should prevent that error. Comment it out by simply adding a # to the beginning of the line.

I'm not sure I'll have time to push a fix until 2015, but if I can find a few spare minutes I'll throw one out.

Thanks for bringing this to my attention! I'll get it sorted as soon as I can.

wolfgame commented 9 years ago

I guess that was the wrong error. When I run XBMal from the Programs menu, it goes through my first tv shows path, which is regular tv shows, then it starts on the anime entry and fails. I'll dig a little more to see if I can find the correct error.

kuruoujou commented 9 years ago

It may have been the right error - that error will only be thrown if it comes across a symbol in a show name that it can't represent as ascii, such as the star in puella magi modaka magica or black rock shooter. A few other shows have funky characters in them that don't always seem funky, such as the 2nd season of seitokai yakuindomo. This particular line is just a logging line, and won't affect the execution of the program at all. It is possible, though, that this is just one of a series of similar problems, though I think I've dealt with most of the unicode issues in the non-logging stuff.

Another workaround that might be a bit better, after looking at the code, is commenting out line 49 in C:\Users\Bill\AppData\Roaming\XBMC\addons\script.service.xbmal\default.py. It will serve the same function, but still allow other logging in the script to work.

Still haven't had time to look at the code itself yet, though, sorry about that. It looks like it's choking on a unicode character for a space, which is a bit funky. It may have something to do with your machine's locale, particularly if you're from a non-english-speaking country. Of course, this is my fault if that's the case, because the program should have been globalized better.

kuruoujou commented 9 years ago

Huh. Didn't quite mean to close this from the commit, but whatever. Could you test 0.4.10 and see if you're still having that issue?

wolfgame commented 9 years ago

It's looking good. Got the whole list and guessing is working for most titles.