Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeErrors #20

Open
dasld opened this issue Mar 22, 2020 · 1 comment
Open

TypeErrors #20

dasld opened this issue Mar 22, 2020 · 1 comment

Comments

@dasld
Copy link

dasld commented Mar 22, 2020

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
Copy link

gits68 commented Dec 17, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants