So, what about "'ascii' codec can't encode characters" error?
I just set my user name as "a" (yes, just one letter), and password as "a" too and this error still remains - ascii codec can't encode characters in position 0-4 ordinal not in range 128.
So, in YouTubeCore.py at line 400 before "request = urllib2.Request(link, urllib.urlencode(get("url_data")))" i add this line:
print(repr(get("url_data")))
and in urllib.py at line 1268 i add
print("PARTS: " +k+" = "+v)
and run my XBMC.
Here is what i got in log now:
Code:
00:23:53 T:5644 NOTICE: YouTube-4.4.6
00:23:53 T:5644 NOTICE: CommonFunctions-2.5.1
00:24:02 T:5644 NOTICE: {u'PersistentCookie': u'yes', u'rmShown': u'1', u'dnConn': u'', u'pstMsg': u'0', u'service': u'youtube', 'Passwd': 'a', u'GALX': u'hwz7h9HA8l8', u'signIn': u'\u0412\u043e\u0439\u0442\u0438', u'continue': u'http://www.youtube.com/signin?action_handle_signin=true&app=desktop&feature=sign_in_button&hl=ru&next=%2F', u'hl': u'ru', u'checkedDomains': u'youtube', u'bgresponse': u'js_disabled', u'_utf8': u'☃', u'Email': 'a', u'checkConnection': u''}
00:24:02 T:5644 NOTICE: PART: PersistentCookie = yes
00:24:02 T:5644 NOTICE: PART: rmShown = 1
00:24:02 T:5644 NOTICE: PART: dnConn =
00:24:02 T:5644 NOTICE: PART: pstMsg = 0
00:24:02 T:5644 NOTICE: PART: service = youtube
00:24:02 T:5644 NOTICE: PART: Passwd = a
00:24:02 T:5644 NOTICE: PART: GALX = hwz7h9HA8l8
00:24:02 T:5644 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 characters in position 15-19: ordinal not in range(128)
Traceback (most recent call last):
File "C:\Users\HTPCUser\AppData\Roaming\XBMC\addons\plugin.video.youtube\default.py", line 120, in <module>
navigation.executeAction(params)
File "C:\Users\HTPCUser\AppData\Roaming\XBMC\addons\plugin.video.youtube\YouTubeNavigation.py", line 122, in executeAction
self.login.login(params)
File "C:\Users\HTPCUser\AppData\Roaming\XBMC\addons\plugin.video.youtube\YouTubeLogin.py", line 75, in login
result, status = self.authorize()
File "C:\Users\HTPCUser\AppData\Roaming\XBMC\addons\plugin.video.youtube\YouTubeLogin.py", line 85, in authorize
(result, status) = self._httpLogin({"new": "true"})
File "C:\Users\HTPCUser\AppData\Roaming\XBMC\addons\plugin.video.youtube\YouTubeLogin.py", line 183, in _httpLogin
ret = self.core._fetchPage(fetch_options)
File "C:\Users\HTPCUser\AppData\Roaming\XBMC\addons\plugin.video.youtube\YouTubeCore.py", line 401, in _fetchPage
request = urllib2.Request(link, urllib.urlencode(get("url_data")))
File "C:\Program Files\XBMC\system\python\Lib\urllib.py", line 1268, in urlencode
print("PART: " +k+" = "+v)
File "<string>", line 7, in write
UnicodeEncodeError: 'ascii' codec can't encode characters in position 15-19: ordinal not in range(128)
-->End of Python script error report<--
As you can see params "Passwd" and "Email" are good - just one letter "a", but error raised in other place - on parsing "u'signIn': u'\u0412\u043e\u0439\u0442\u0438'" pair. I do not know what this parameter, i can't find it in code, there is even no "SignIn" subtext in source files. But this unicode string represents russian translation of "Sign in" word. Is there any way to fix it?
PS. Sorry for my terrible english.