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

[APP SUBMITTED]: TypeError: Object of type bytes is not JSON serializable #8245

Closed
gilberth opened this issue Jul 20, 2020 · 15 comments · Fixed by #8187
Closed

[APP SUBMITTED]: TypeError: Object of type bytes is not JSON serializable #8245

gilberth opened this issue Jul 20, 2020 · 15 comments · Fixed by #8187
Labels
triage Untriaged issue

Comments

@gilberth
Copy link

INFO

Python Version: 3.8.2 (default, Apr 27 2020, 15:53:34) [GCC 9.3.0]
Operating System: Linux-5.4.0-40-generic-x86_64-with-glibc2.29
Locale: UTF-8
Branch: master
Database: 44.15
Commit: d9c31da
Link to Log: https://gist.github.com/4d5bbc00a6705968144841b2e05c9a28

ERROR

2020-07-20 05:50:12 ERROR    SNATCHQUEUE-SNATCH-281949 :: [d9c31da] Transmission: Failed Sending Torrent
Traceback (most recent call last):
  File "/opt/medusa/medusa/clients/torrent/generic.py", line 270, in send_torrent
    if not self._set_torrent_ratio(result):
  File "/opt/medusa/medusa/clients/torrent/transmission.py", line 149, in _set_torrent_ratio
    post_data = json.dumps({
  File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable

STAFF NOTIFIED: @pymedusa/support @pymedusa/moderators

@triage-new-issues triage-new-issues bot added the triage Untriaged issue label Jul 20, 2020
@p0psicles
Copy link
Contributor

p0psicles commented Jul 20, 2020

@medariox shouldn't we make sure that hash is always stored utf-8 encoded? Else can you take a look at this?
https://github.com/pymedusa/Medusa/blob/master/medusa/classes.py#L80
https://github.com/pymedusa/Medusa/blob/master/medusa/clients/torrent/generic.py#L208

@sharkykh
Copy link
Contributor

this is a bug in bencode, I think #8149 introduced this bug (my bad for not catching it) and #8187 (which might need a little refactor) should fix it

@sharkykh sharkykh linked a pull request Jul 20, 2020 that will close this issue
1 task
@gilberth
Copy link
Author

INFO

Python Version: 3.8.2 (default, Apr 27 2020, 15:53:34) [GCC 9.3.0]
Operating System: Linux-5.4.0-40-generic-x86_64-with-glibc2.29
Locale: UTF-8
Branch: master
Database: 44.15
Commit: d9c31da
Link to Log: https://gist.github.com/1c2dcc78d562cccb814f3508cbac9da1

ERROR

2020-07-24 06:02:33 ERROR    SNATCHQUEUE-SNATCH-368862 :: [d9c31da] Transmission: Failed Sending Torrent
Traceback (most recent call last):
  File "/opt/medusa/medusa/clients/torrent/generic.py", line 270, in send_torrent
    if not self._set_torrent_ratio(result):
  File "/opt/medusa/medusa/clients/torrent/transmission.py", line 149, in _set_torrent_ratio
    post_data = json.dumps({
  File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable

STAFF NOTIFIED: @pymedusa/support @pymedusa/moderators

@p0psicles
Copy link
Contributor

Fixed in develop branch

@gilberth
Copy link
Author

INFO

Python Version: 3.8.2 (default, Apr 27 2020, 15:53:34) [GCC 9.3.0]
Operating System: Linux-5.4.0-40-generic-x86_64-with-glibc2.29
Locale: UTF-8
Branch: master
Database: 44.15
Commit: d9c31da
Link to Log: https://gist.github.com/278c696a34082ed2a361d756d67463d6

ERROR

2020-07-24 06:56:22 ERROR    SNATCHQUEUE-SNATCH-267435 :: [d9c31da] Transmission: Failed Sending Torrent
Traceback (most recent call last):
  File "/opt/medusa/medusa/clients/torrent/generic.py", line 270, in send_torrent
    if not self._set_torrent_ratio(result):
  File "/opt/medusa/medusa/clients/torrent/transmission.py", line 149, in _set_torrent_ratio
    post_data = json.dumps({
  File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable

STAFF NOTIFIED: @pymedusa/support @pymedusa/moderators

@gilberth
Copy link
Author

INFO

Python Version: 3.8.2 (default, Apr 27 2020, 15:53:34) [GCC 9.3.0]
Operating System: Linux-5.4.0-40-generic-x86_64-with-glibc2.29
Locale: UTF-8
Branch: master
Database: 44.15
Commit: d9c31da
Link to Log: https://gist.github.com/63f0d3152ca55758f669fe7e40e70b74

ERROR

2020-07-30 17:48:11 ERROR    SNATCHQUEUE-SNATCH-267435 :: [d9c31da] Transmission: Failed Sending Torrent
Traceback (most recent call last):
  File "/opt/medusa/medusa/clients/torrent/generic.py", line 270, in send_torrent
    if not self._set_torrent_ratio(result):
  File "/opt/medusa/medusa/clients/torrent/transmission.py", line 149, in _set_torrent_ratio
    post_data = json.dumps({
  File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable

STAFF NOTIFIED: @pymedusa/support @pymedusa/moderators

@gilberth
Copy link
Author

INFO

Python Version: 3.8.2 (default, Apr 27 2020, 15:53:34) [GCC 9.3.0]
Operating System: Linux-5.4.0-40-generic-x86_64-with-glibc2.29
Locale: UTF-8
Branch: master
Database: 44.15
Commit: d9c31da
Link to Log: https://gist.github.com/e64e397ab8b6f397a02b493822d2fe25

ERROR

2020-07-31 19:10:10 ERROR    SNATCHQUEUE-SNATCH-380654 :: [d9c31da] Transmission: Failed Sending Torrent
Traceback (most recent call last):
  File "/opt/medusa/medusa/clients/torrent/generic.py", line 270, in send_torrent
    if not self._set_torrent_ratio(result):
  File "/opt/medusa/medusa/clients/torrent/transmission.py", line 149, in _set_torrent_ratio
    post_data = json.dumps({
  File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable

STAFF NOTIFIED: @pymedusa/support @pymedusa/moderators

@gilberth
Copy link
Author

gilberth commented Aug 2, 2020

INFO

Python Version: 3.8.2 (default, Apr 27 2020, 15:53:34) [GCC 9.3.0]
Operating System: Linux-5.4.0-40-generic-x86_64-with-glibc2.29
Locale: UTF-8
Branch: master
Database: 44.15
Commit: d9c31da
Link to Log: https://gist.github.com/3b81cbce53e39561bb1724f627ecf750

ERROR

2020-08-02 03:33:42 ERROR    SNATCHQUEUE-SNATCH-369048 :: [d9c31da] Transmission: Failed Sending Torrent
Traceback (most recent call last):
  File "/opt/medusa/medusa/clients/torrent/generic.py", line 270, in send_torrent
    if not self._set_torrent_ratio(result):
  File "/opt/medusa/medusa/clients/torrent/transmission.py", line 149, in _set_torrent_ratio
    post_data = json.dumps({
  File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable

STAFF NOTIFIED: @pymedusa/support @pymedusa/moderators

@gilberth
Copy link
Author

INFO

Python Version: 3.8.2 (default, Jul 16 2020, 14:00:26) [GCC 9.3.0]
Operating System: Linux-5.4.0-47-generic-x86_64-with-glibc2.29
Locale: UTF-8
Branch: master
Database: 44.16
Commit: b352bb6
Link to Log: No Log available

ERROR

2020-09-18 18:51:29 ERROR    SNATCHQUEUE-SNATCH-380654 :: [b352bb6] Transmission: Failed Sending Torrent
Traceback (most recent call last):
  File "/opt/medusa/medusa/clients/torrent/generic.py", line 270, in send_torrent
    if not self._set_torrent_ratio(result):
  File "/opt/medusa/medusa/clients/torrent/transmission.py", line 149, in _set_torrent_ratio
    post_data = json.dumps({
  File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable

STAFF NOTIFIED: @pymedusa/support @pymedusa/moderators

@gilberth
Copy link
Author

gilberth commented Oct 2, 2020

INFO

Python Version: 3.8.2 (default, Jul 16 2020, 14:00:26) [GCC 9.3.0]
Operating System: Linux-5.4.0-47-generic-x86_64-with-glibc2.29
Locale: UTF-8
Branch: master
Database: 44.16
Commit: b352bb6
Link to Log: https://gist.github.com/3736a422c982042e27f9b12b60bd298f

ERROR

2020-10-01 08:02:16 ERROR    SNATCHQUEUE-SNATCH-81831 :: [b352bb6] Transmission: Failed Sending Torrent
Traceback (most recent call last):
  File "/opt/medusa/medusa/clients/torrent/generic.py", line 270, in send_torrent
    if not self._set_torrent_ratio(result):
  File "/opt/medusa/medusa/clients/torrent/transmission.py", line 149, in _set_torrent_ratio
    post_data = json.dumps({
  File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable

STAFF NOTIFIED: @pymedusa/support @pymedusa/moderators

@p0psicles
Copy link
Contributor

@sharkykh should be fixed right?

@p0psicles
Copy link
Contributor

Should be really fixed this time. Tnx @sharkykh

@gilberth
Copy link
Author

INFO

Python Version: 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]
Operating System: Linux-5.4.0-48-generic-x86_64-with-glibc2.29
Locale: UTF-8
Branch: master
Database: 44.16
Commit: b352bb6
Link to Log: No Log available

ERROR

2020-10-17 17:41:12 ERROR    SNATCHQUEUE-SNATCH-278329 :: [b352bb6] Transmission: Failed Sending Torrent
Traceback (most recent call last):
  File "/opt/medusa/medusa/clients/torrent/generic.py", line 270, in send_torrent
    if not self._set_torrent_ratio(result):
  File "/opt/medusa/medusa/clients/torrent/transmission.py", line 149, in _set_torrent_ratio
    post_data = json.dumps({
  File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable

STAFF NOTIFIED: @pymedusa/support @pymedusa/moderators

@LordDrakath
Copy link

INFO

Python Version: 3.7.9 (default, Oct 3 2020, 01:26:44) [Clang 10.0.0 (git@github.com:llvm/llvm-project.git llvmorg-10.0.0-0-gd32170dbd
Operating System: FreeBSD-11.2-STABLE-amd64-64bit-ELF
Locale: UTF-8
Branch: master
Database: 44.16
Commit: b352bb6
Link to Log: https://gist.github.com/4ed0dedee6cdf1f252b1ecc599be055d

ERROR

2020-10-23 19:51:39 ERROR    POSTPROCESSOR :: [b352bb6] Exception generated: Object of type bytes is not JSON serializable
Traceback (most recent call last):
  File "/usr/local/medusa/medusa/scheduler.py", line 78, in run
    self.action.run(self.force)
  File "/usr/local/medusa/medusa/process_tv.py", line 65, in run
    return ProcessResult(path, process_method).process(force=force, **kwargs)
  File "/usr/local/medusa/medusa/process_tv.py", line 215, in process
    if self.move_torrent(info_hash, release_names):
  File "/usr/local/medusa/medusa/process_tv.py", line 713, in move_torrent
    torrent_moved = client.move_torrent(info_hash)
  File "/usr/local/medusa/medusa/clients/torrent/transmission.py", line 245, in move_torrent
    'method': 'torrent-set-location',
  File "/usr/local/lib/python3.7/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/local/lib/python3.7/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/lib/python3.7/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/local/lib/python3.7/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable

STAFF NOTIFIED: @pymedusa/support @pymedusa/moderators

@LordDrakath
Copy link

INFO

Python Version: 3.7.9 (default, Oct 3 2020, 01:26:44) [Clang 10.0.0 (git@github.com:llvm/llvm-project.git llvmorg-10.0.0-0-gd32170dbd
Operating System: FreeBSD-11.2-STABLE-amd64-64bit-ELF
Locale: UTF-8
Branch: master
Database: 44.16
Commit: b352bb6
Link to Log: https://gist.github.com/ed913f808dca211d0a3a4bdfcbe35bba

ERROR

2020-10-23 19:45:21 ERROR    SNATCHQUEUE-SNATCH-289882 :: [b352bb6] Transmission: Failed Sending Torrent
Traceback (most recent call last):
  File "/usr/local/medusa/medusa/clients/torrent/generic.py", line 270, in send_torrent
    if not self._set_torrent_ratio(result):
  File "/usr/local/medusa/medusa/clients/torrent/transmission.py", line 151, in _set_torrent_ratio
    'method': 'torrent-set',
  File "/usr/local/lib/python3.7/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/local/lib/python3.7/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/lib/python3.7/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/local/lib/python3.7/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable

STAFF NOTIFIED: @pymedusa/support @pymedusa/moderators

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

Successfully merging a pull request may close this issue.

4 participants