encukou / lastscrape-gui

GUI for getting scrobbles from last.fm and moving them somewhere else
http://encukou.github.com/lastscrape-gui
117 stars 28 forks source link

TypeErrors #20

Open dasld opened 4 years ago

dasld commented 4 years ago

On Ubuntu 18.04.4 and Python 3.6.9, I can fetch last.fm data, but the following happens when I try to push them to libre.fm:

Traceback (most recent call last):
  File "gui.py", line 364, in run
    self.scrobbler.add_track(scrobble.ScrobbleTrack(timestamp, trackname, artistname, albumname, trackmbid))
  File "/home/daniel/Software/encukou-lastscrape-gui-6d3bf45/scrobble.py", line 94, in add_track
    self.submit(sleep_func)
  File "/home/daniel/Software/encukou-lastscrape-gui-6d3bf45/scrobble.py", line 65, in submit
    response = urlopen(self.submit_url, urlencode(data)).read()
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 524, in open
    req = meth(req)
  File "/usr/lib/python3.6/urllib/request.py", line 1248, in do_request_
    raise TypeError(msg)
TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type str.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "gui.py", line 369, in run
    backtrace = traceback.format_exc(e)
  File "/usr/lib/python3.6/traceback.py", line 167, in format_exc
    return "".join(format_exception(*sys.exc_info(), limit=limit, chain=chain))
  File "/usr/lib/python3.6/traceback.py", line 121, in format_exception
    type(value), value, tb, limit=limit).format(chain=chain))
  File "/usr/lib/python3.6/traceback.py", line 509, in __init__
    capture_locals=capture_locals)
  File "/usr/lib/python3.6/traceback.py", line 338, in extract
    if limit >= 0:
TypeError: '>=' not supported between instances of 'TypeError' and 'int'

The status bar tells me that 50 tracks have been scrobbled and a popup says that everything has finished successfully, but nothing has been actually scrobbled.

gits68 commented 3 years ago

at line 65 in file scrobble.py, change urlencode(data) to urlencode(data).encode('ascii') also, at line 76, change 'OK' to b'OK'