Comment 9 for bug 406231

Revision history for this message
Yakov Mindelis (jackitg) wrote : Re: [Bug 406231] Re: audioscrobbler won't login/submit problems

Hi Mathias,

On Wed, 29 Jul 2009, Mathias Brodala wrote:

>
> 1. Fire up a terminal and go to the directory of the audioscrobbler
> plugin (where __init__.py and all the others are located)
>
> 2. Launch the python interactive console
>
> 3. Import _scrobbler
>
> 4. Try _scrobbler.login($username, $password_hash, hashpw=False,
> post_url='http://post.audioscrobbler.com/')
>
> 5. Try _scrobbler.login($username, $password, hashpw=True,
> post_url='http://post.audioscrobbler.com/')
>
> Both 4. and 5. should yield no exceptions.
>
It depend on the network I'm using. At home no problems, at work: (after
modifying default post_url value of login() to have http://):

In [15]: _scrobbler.login("jitg", pw, hashpw=True,
post_url='http://post.audioscrobbler.com/' )
['OK', '7a237448f6a942f58c1ee537c2c4205e',
'http://post.audioscrobbler.com:80/np_1.2',
'http://post2.audioscrobbler.com:80/protocol_1.2', '']

In [16]: _scrobbler.login("jitg", pw, hashpw=True,
post_url='http://post.audioscrobbler.com/' )
['']

In [17]: _scrobbler.login("jitg", pw, hashpw=True)
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (105, 0))

---------------------------------------------------------------------------
BadStatusLine Traceback (most recent call
last)

/Users/jack/exaile_bazaar/exaile/plugins/audioscrobbler/<ipython console>
in <module>()

/Users/jack/exaile_bazaar/exaile/plugins/audioscrobbler/_scrobbler.py in
login(user, password, hashpw, client, post_url)
      85 data = urllib.urlencode(values)
      86 req = urllib2.Request("%s?%s" % (url, data) )
---> 87 response = urllib2.urlopen(req)
      88 result = response.read()
      89 lines = result.split('\n')

/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.pyc
in urlopen(url, data)
     122 if _opener is None:
     123 _opener = build_opener()
--> 124 return _opener.open(url, data)
     125
     126 def install_opener(opener):

/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.pyc
in open(self, fullurl, data)
     379 req = meth(req)
     380
--> 381 response = self._open(req, data)
     382
     383 # post-process response

/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.pyc
in _open(self, req, data)
     397 protocol = req.get_type()
     398 result = self._call_chain(self.handle_open, protocol,
protocol +
--> 399 '_open', req)
     400 if result:
     401 return result

/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.pyc
in _call_chain(self, chain, kind, meth_name, *args)
     358 func = getattr(handler, meth_name)
     359
--> 360 result = func(*args)
     361 if result is not None:
     362 return result

/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.pyc
in http_open(self, req)
    1105
    1106 def http_open(self, req):
-> 1107 return self.do_open(httplib.HTTPConnection, req)
    1108
    1109 http_request = AbstractHTTPHandler.do_request_

/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.pyc
in do_open(self, http_class, req)
    1078 try:
    1079 h.request(req.get_method(), req.get_selector(),
req.data, headers)
-> 1080 r = h.getresponse()
    1081 except socket.error, err: # XXX what error?
    1082 raise URLError(err)

/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/httplib.pyc
in getresponse(self)
     926 method=self._method)
     927
--> 928 response.begin()
     929 assert response.will_close != _UNKNOWN
     930 self.__state = _CS_IDLE

/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/httplib.pyc
in begin(self)
     383 # read until we get a non-100 response
     384 while True:
--> 385 version, status, reason = self._read_status()
     386 if status != CONTINUE:
     387 break

/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/httplib.pyc
in _read_status(self)
     347 # Presumably, the server closed the connection before
     348 # sending a valid response.
--> 349 raise BadStatusLine(line)
     350 try:
     351 [version, status, reason] = line.split(None, 2)

BadStatusLine:

All this were fired in a row.
Looks like urllib2 has trouble with networking here...
I'm hooked to a switch which is hooked to another switch shich has adsl
modem connected to it.

Jack