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

args JSON serialize issue when using PickleEncoder #188

Open
huubbouma opened this issue Feb 25, 2025 · 0 comments
Open

args JSON serialize issue when using PickleEncoder #188

huubbouma opened this issue Feb 25, 2025 · 0 comments

Comments

@huubbouma
Copy link

Very similar to issue #135 when an object in the kwargs was giving issues.
In another (old django project) I migrated from django-rq and I used the PickleEncoder

Now the args in the message_dict is the cause of the problem. In #135 it was the kwargs

(in my case a MediationRequest object)

  File "/home/huub/projects/demo/django_dramatiq/django_dramatiq/admin.py", line 48, in message_details
    message_details = json.dumps(message_dict, indent=4)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/huub/.pyenv/versions/3.12.9/lib/python3.12/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
          ^^^^^^^^^^^
  File "/home/huub/.pyenv/versions/3.12.9/lib/python3.12/json/encoder.py", line 202, in encode
    chunks = list(chunks)
             ^^^^^^^^^^^^
  File "/home/huub/.pyenv/versions/3.12.9/lib/python3.12/json/encoder.py", line 432, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/home/huub/.pyenv/versions/3.12.9/lib/python3.12/json/encoder.py", line 406, in _iterencode_dict
    yield from chunks
  File "/home/huub/.pyenv/versions/3.12.9/lib/python3.12/json/encoder.py", line 326, in _iterencode_list
    yield from chunks
  File "/home/huub/.pyenv/versions/3.12.9/lib/python3.12/json/encoder.py", line 439, in _iterencode
    o = _default(o)
        ^^^^^^^^^^^
  File "/home/huub/.pyenv/versions/3.12.9/lib/python3.12/json/encoder.py", line 180, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type MediationRequest is not JSON serializable
huubbouma pushed a commit to huubbouma/django_dramatiq that referenced this issue Feb 25, 2025
huubbouma pushed a commit to huubbouma/django_dramatiq that referenced this issue Feb 25, 2025
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

1 participant