BitTornado icon indicating copy to clipboard operation
BitTornado copied to clipboard

codec can't decode byte 0xa0 in position 13

Open Yuuki2012 opened this issue 9 years ago • 6 comments

I don't have the Traceback from the 'str' TypeError, it disappeared in my screen window

TypeError: 'str' does not support the buffer interface
Traceback (most recent call last):
  File "/home/BitTornado/BitTornado/Network/RawServer.py", line 120, in listen_forever
    self.sockethandler.handle_events(events)
  File "/home/BitTornado/BitTornado/Network/SocketHandler.py", line 296, in handle_events
    s.handler.data_came_in(s, data)
  File "/home/BitTornado/BitTornado/Tracker/HTTPHandler.py", line 148, in data_came_in
    if not c.data_came_in(data) and not c.closed:
  File "/home/BitTornado/BitTornado/Tracker/HTTPHandler.py", line 35, in data_came_in
    self.next_func = self.next_func(val.decode())
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 13: invalid start byte
Traceback (most recent call last):
  File "/home/BitTornado/BitTornado/Network/RawServer.py", line 120, in listen_forever
    self.sockethandler.handle_events(events)
  File "/home/BitTornado/BitTornado/Network/SocketHandler.py", line 296, in handle_events
    s.handler.data_came_in(s, data)
  File "/home/BitTornado/BitTornado/Tracker/HTTPHandler.py", line 148, in data_came_in
    if not c.data_came_in(data) and not c.closed:
  File "/home/BitTornado/BitTornado/Tracker/HTTPHandler.py", line 35, in data_came_in
    self.next_func = self.next_func(val.decode())

Hi again ^^ I have a new error for you, I'm assuming it's caused by a '!' in the filename, I'm currently trying to test this. (basically moving the file out of the parse directory and check if the error still appears)

EDIT: I removed the ' ! ' from the filename and the error seems to have disappeared, I'll edit or reply again when I see the same error again.

EDIT2: Nope that was not the issue, I don't know what else it could be.

Yuuki2012 avatar Sep 18 '16 17:09 Yuuki2012

Hmm. I'll have a look. Thanks for the report.

effigies avatar Sep 18 '16 21:09 effigies

What branch/commit are you using?

effigies avatar Sep 18 '16 21:09 effigies

The latest one I should be using (with the latest error fix I've reported)

$ git pull origin issue_46 ^ last command I've ran

$ git branch

  • master

Yuuki2012 avatar Sep 19 '16 03:09 Yuuki2012

Changing the

self.next_func = self.next_func(val.decode())

to

self.next_func = self.next_func(val.decode('cp1252'))

on Tracker/HTTPHandler.py seems to have worked, I'm not sure if I should be using cp1252 but it fixed the crashing at least. (for now)

Yuuki2012 avatar Sep 19 '16 03:09 Yuuki2012

I suspect that works only because 0xA0 is a valid code point in cp1252, not that information is actually being transmitted in cp1252.

Is it a specific .torrent file that's causing this issue? If you could share that, I may be able to reproduce and track down the bug.

effigies avatar Sep 19 '16 14:09 effigies

I'm not sure which torrent it is (or if it's even a torrent causing it), but SHOULD be one of these: http://www.nyaa.se/?page=download&tid=851191 http://www.nyaa.se/?page=download&tid=851185 http://www.nyaa.se/?page=download&tid=851095 http://www.nyaa.se/?page=download&tid=851203 those were uploaded before the crashes happened

Yuuki2012 avatar Sep 19 '16 15:09 Yuuki2012