python2.6 for ATV2 and python2.7 for linux?
#1
Is it just me or ATV2 uses python 2.6 and linux uses python 2.7?

Im asking because python 2.6 has a known bug with HTTP authentication.

If you supply the correct user and password, it works with both 2.6 and 2.7 but if you supply a wrong password 2.6 loops asking for a user and password until it crashes. Python 2.7 urllib2 is fine, problem is just with wrong passwords with python urllib2.

heres the bug:
http://bugs.python.org/issue8894
http://bugs.python.org/issue8797

I had to edit the urllib2.py inside the ATV2 to make authentication work, under linux I had to do nothing.. Heres how I fixed it...

replace:
if req.headers.get(self.auth_header, None) == auth:
return None
req.add_header(self.auth_header, auth)

with:

if req.get_header(self.auth_header, None) == auth:
return None
req.add_unredirected_header(self.auth_header, auth)

Hope this helps someone.
Reply
#2
linux uses what the disto has installed, osx/ios uses what we specify for depends in tools/darwin/depends.
Reply
#3
davilla Wrote:linux uses what the disto has installed, osx/ios uses what we specify for depends in tools/darwin/depends.

if possible davila, just patch urllib2 for future python scripts. If a user provides a wrong user or password theres no way to catch the error code as the code just keeps asking for a user and password.

Its very helpful to notify the error instead of crashing and not knowing why, Im talking about the user.

I dont know if you could prepatch the urllib2.py file, but thanks anyway for your insightful reply Smile
Reply
#4
Quote:if req.get_header(self.auth_header, None) == auth:
return None
req.add_unredirected_header(self.auth_header, auth)

That's already present in python26/Python-2.6.5/Lib/urllib2.py
Reply
#5
davilla Wrote:That's already present in python26/Python-2.6.5/Lib/urllib2.py

Will you specify in future xbmc ios version python 2.6.5? I have the official version installed and dont follow the nightlys...
Reply
#6
pythonn00b Wrote:Will you specify in future xbmc ios version python 2.6.5? I have the official version installed and dont follow the nightlys...

Sorry, don't grep what you are trying to say. 10.0-9 was the last "official release", it's running python 2.6.5. What version is your "official release", 10.0-7 ?
Reply
#7
hehe, sorry, im running 10.0.9 thats the official version I believe, What I wanted to know is if this library will be patched later on with a future official release? Because 10.0.9 has the error in the urllib2 library. Im writting an addon which relies on the error message thats returned from the www and the only way my addon works is editting the library manually myself.

So Im asking when do you think this will be fixed? Thanks davila.
Reply
#8
pythonn00b Wrote:hehe, sorry, im running 10.0.9 thats the official version I believe, What I wanted to know is if this library will be patched later on with a future official release? Because 10.0.9 has the error in the urllib2 library. Im writting an addon which relies on the error message thats returned from the www and the only way my addon works is editting the library manually myself.

So Im asking when do you think this will be fixed? Thanks davila.

I checked tools/darwin/depends/python26/Python-2.6.5/Lib/urllib2.py
I also checked /Applications/XBMC.frappliance/Frameworks/lib/python2.6/urllib2.py in a new install of xbmc under 4.3.

Both already have the change you pointed out. Therefore, there's nothing to fix Smile
Reply
#9
cool! thanks, lets just now wait for a new "official" build!
Reply

Logout Mark Read Team Forum Stats Members Help
python2.6 for ATV2 and python2.7 for linux?0