{"action":"created","issue":{"url":"https://api.github.com/repos/cibboy/script.profilecleaner/issues/2","repository_url":"https://api.github.com/repos/cibboy/script.profilecleaner","labels_url":"https://api.github.com/repos/cibboy/script.profilecleaner/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/cibboy/script.profilecleaner/issues/2/comments","events_url":"https://api.github.com/repos/cibboy/script.profilecleaner/issues/2/events","html_url":"https://github.com/cibboy/script.profilecleaner/issues/2","id":157592535,"number":2,"title":"Addon Exception - unicode file/path issue","user":{"login":"mgonzales71","id":6510026,"avatar_url":"https://avatars.githubusercontent.com/u/6510026?v=3","gravatar_id":"","url":"https://api.github.com/users/mgonzales71","html_url":"https://github.com/mgonzales71","followers_url":"https://api.github.com/users/mgonzales71/followers","following_url":"https://api.github.com/users/mgonzales71/following{/other_user}","gists_url":"https://api.github.com/users/mgonzales71/gists{/gist_id}","starred_url":"https://api.github.com/users/mgonzales71/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgonzales71/subscriptions","organizations_url":"https://api.github.com/users/mgonzales71/orgs","repos_url":"https://api.github.com/users/mgonzales71/repos","events_url":"https://api.github.com/users/mgonzales71/events{/privacy}","received_events_url":"https://api.github.com/users/mgonzales71/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-05-31T05:28:59Z","updated_at":"2016-06-03T12:45:30Z","closed_at":null,"body":"Hi cibboy,\r\n\r\nFound your addon today and decided to give it a test.\r\n\r\nHit an exception with the addon cleanup portion of the script, looks like it is due to special characters in unicode file / path names.\r\n\r\nError:\r\n```\r\n22:03:52 T:6372  NOTICE: [Profile Cleaner] - Addon cleanup started at 2016-05-30 22:03:30\r\n22:03:56 T:6372   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--\r\n                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!\r\n                                            Error Type: <type 'exceptions.WindowsError'>\r\n                                            Error Contents: (2, 'The system cannot find the file specified', 'C:\\\\Users\\\\Mario\\\\AppData\\\\Roaming\\\\Kodi\\\\userdata\\\\addon_data\\\\script.skin.helper.service\\\\artworkcache\\\\Cherno\\xb4bil, la noche del fin del mundo-2008.xml')\r\n                                            Traceback (most recent call last):\r\n                                              File \"C:\\Users\\Mario\\AppData\\Roaming\\Kodi\\addons\\script.profilecleaner\\script.py\", line 981, in <module>\r\n                                                elif selection == 3: remain = True; Cleaner().PerformCleanup(8)\r\n                                              File \"C:\\Users\\Mario\\AppData\\Roaming\\Kodi\\addons\\script.profilecleaner\\script.py\", line 963, in PerformCleanup\r\n                                                self.AddonCleanup()\r\n                                              File \"C:\\Users\\Mario\\AppData\\Roaming\\Kodi\\addons\\script.profilecleaner\\script.py\", line 775, in AddonCleanup\r\n                                                self.totalAddonSize = self.totalAddonSize + self.GetFolderSize(os.path.join(addonData, item))\r\n                                              File \"C:\\Users\\Mario\\AppData\\Roaming\\Kodi\\addons\\script.profilecleaner\\script.py\", line 752, in GetFolderSize\r\n                                                total_size += os.path.getsize(fp)\r\n                                              File \"C:\\Program Files (x86)\\Kodi\\system\\python\\Lib\\genericpath.py\", line 49, in getsize\r\n                                                return os.stat(filename).st_size\r\n                                            WindowsError: (2, 'The system cannot find the file specified', 'C:\\\\Users\\\\Mario\\\\AppData\\\\Roaming\\\\Kodi\\\\userdata\\\\addon_data\\\\script.skin.helper.service\\\\artworkcache\\\\Cherno\\xb4bil, la noche del fin del mundo-2008.xml')\r\n                                            -->End of Python script error report<--\r\n```\r\n\r\nthe path and file name:\r\n\r\n**C:\\Users\\Mario\\AppData\\Roaming\\Kodi\\userdata\\addon_data\\script.skin.helper.service\\artworkcache\\Chernóbil, la noche del fin del mundo-2008.xml**\r\n\r\nIf I delete the file in question the script eventually hit another file / path with a special character in it and again throws an exception:\r\n\r\n```\r\n22:15:52 T:6988  NOTICE: [Profile Cleaner] - Addon cleanup started at 2016-05-30 22:15:30\r\n22:15:56 T:6988   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--\r\n                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!\r\n                                            Error Type: <type 'exceptions.WindowsError'>\r\n                                            Error Contents: (2, 'The system cannot find the file specified', 'C:\\\\Users\\\\Mario\\\\AppData\\\\Roaming\\\\Kodi\\\\userdata\\\\addon_data\\\\script.skin.helper.service\\\\artworkcache\\\\Csernobil O\\xa8ro\\xa8kse\\xb4ge a Zo\\xb4na-2011.xml')\r\n                                            Traceback (most recent call last):\r\n                                              File \"C:\\Users\\Mario\\AppData\\Roaming\\Kodi\\addons\\script.profilecleaner\\script.py\", line 981, in <module>\r\n                                                elif selection == 3: remain = True; Cleaner().PerformCleanup(8)\r\n                                              File \"C:\\Users\\Mario\\AppData\\Roaming\\Kodi\\addons\\script.profilecleaner\\script.py\", line 963, in PerformCleanup\r\n                                                self.AddonCleanup()\r\n                                              File \"C:\\Users\\Mario\\AppData\\Roaming\\Kodi\\addons\\script.profilecleaner\\script.py\", line 775, in AddonCleanup\r\n                                                self.totalAddonSize = self.totalAddonSize + self.GetFolderSize(os.path.join(addonData, item))\r\n                                              File \"C:\\Users\\Mario\\AppData\\Roaming\\Kodi\\addons\\script.profilecleaner\\script.py\", line 752, in GetFolderSize\r\n                                                total_size += os.path.getsize(fp)\r\n                                              File \"C:\\Program Files (x86)\\Kodi\\system\\python\\Lib\\genericpath.py\", line 49, in getsize\r\n                                                return os.stat(filename).st_size\r\n                                            WindowsError: (2, 'The system cannot find the file specified', 'C:\\\\Users\\\\Mario\\\\AppData\\\\Roaming\\\\Kodi\\\\userdata\\\\addon_data\\\\script.skin.helper.service\\\\artworkcache\\\\Csernobil O\\xa8ro\\xa8kse\\xb4ge a Zo\\xb4na-2011.xml')\r\n                                            -->End of Python script error report<--\r\n```\r\n\r\nThis time for:\r\n\r\n**C:\\Users\\Mario\\AppData\\Roaming\\Kodi\\userdata\\addon_data\\script.skin.helper.service\\artworkcache\\Csernobil Öröksége a Zóna-2011.xml**\r\n\r\na pretty picture :smile:\r\n\r\n![2016-05-30_22-08-44](https://cloud.githubusercontent.com/assets/6510026/15663989/088c5fa2-26b5-11e6-81eb-d730799c2822.png)\r\n\r\nThanks for coding this - I had considered trying the texture cache maintenance utillity but don't want to mess with scripts especially when I have non-computer folks that I don't want to hold a special class to teach them how to use it.\r\n\r\nHave a great week!\r\n\r\nMario"},"comment":{"url":"https://api.github.com/repos/cibboy/script.profilecleaner/issues/comments/223569105","html_url":"https://github.com/cibboy/script.profilecleaner/issues/2#issuecomment-223569105","issue_url":"https://api.github.com/repos/cibboy/script.profilecleaner/issues/2","id":223569105,"user":{"login":"cibboy","id":2605826,"avatar_url":"https://avatars.githubusercontent.com/u/2605826?v=3","gravatar_id":"","url":"https://api.github.com/users/cibboy","html_url":"https://github.com/cibboy","followers_url":"https://api.github.com/users/cibboy/followers","following_url":"https://api.github.com/users/cibboy/following{/other_user}","gists_url":"https://api.github.com/users/cibboy/gists{/gist_id}","starred_url":"https://api.github.com/users/cibboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cibboy/subscriptions","organizations_url":"https://api.github.com/users/cibboy/orgs","repos_url":"https://api.github.com/users/cibboy/repos","events_url":"https://api.github.com/users/cibboy/events{/privacy}","received_events_url":"https://api.github.com/users/cibboy/received_events","type":"User","site_admin":false},"created_at":"2016-06-03T12:45:30Z","updated_at":"2016-06-03T12:45:30Z","body":"I don't know Python well either, unfortunately :)\r\nI doubt, though, that it's a bug in Python 2.x (even though reading those posts make me wish for Python 3.x in Kodi).\r\nSince we're all grasping at straws here, could you please try and replace line 751 with:\r\n`fp = os.path.join(dirpath, f).encode('utf-8')`\r\nWhen I try it I get an exception because my string is already encoded in utf-8 I guess, but maybe yours isn't, so it could solve your issue.\r\n\r\nLet me know."}}
{"actor":{"display_login":"cibboy"}}