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

dill.loads(): AttributeError: can't set attribute #673

Open
githubdontbanmeagain opened this issue Aug 7, 2024 · 0 comments
Open

dill.loads(): AttributeError: can't set attribute #673

githubdontbanmeagain opened this issue Aug 7, 2024 · 0 comments

Comments

@githubdontbanmeagain
Copy link

Minimal reproduction steps

reproduce.py

import discord
import dill


class myClient:
    def __init__(self):
        self.client = discord.Client()

def main():
    data = {'client': myClient()}
    
    serialized = dill.dumps(data)
    print(serialized)
    
    unserialized = dill.loads(serialized)
    print(unserialized)


if __name__ == "__main__":
    main()
pip install discord.py-self
py reproduce.py

dumps() seems to work fine, but it fails at loads(). This is the traceback:

Traceback (most recent call last):
  File "C:\Users\x\reproduce.py", line 28, in <module>
    main()
  File "C:\Users\x\reproduce.py", line 18, in main
    unserialized = dill.loads(serialized)
  File "C:\Users\x\AppData\Local\Programs\Python\Python39\lib\site-packages\dill\_dill.py", line 303, in loads
    return load(file, ignore, **kwds)
  File "C:\Users\x\AppData\Local\Programs\Python\Python39\lib\site-packages\dill\_dill.py", line 289, in load
    return Unpickler(file, ignore=ignore, **kwds).load()
  File "C:\Users\x\AppData\Local\Programs\Python\Python39\lib\site-packages\dill\_dill.py", line 444, in load
    obj = StockUnpickler.load(self)
AttributeError: can't set attribute

Class which causes the error:
https://github.com/dolfies/discord.py-self/blob/master/discord/client.py#L144

Why is this happening? How can I prevent it?

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