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

TypeError: __init__() missing 2 required positional arguments: 'e' and 'http_resp' #526

Open
IamJasonBoy opened this issue Nov 22, 2023 · 1 comment

Comments

@IamJasonBoy
Copy link

TypeError: init() missing 2 required positional arguments: 'e' and 'http_resp'

e = ApiResponseInvalidError(Exception("test"), RequestsResp())

p = cloudpickle.dumps(e)
loaded_e = cloudpickle.loads(p)
print(loaded_e)

My code is quite complex and difficult to post. I want to know how to locate it and why there are errors

@ogrisel
Copy link
Contributor

ogrisel commented Apr 9, 2024

My code is quite complex and difficult to post. I want to know how to locate it and why there are errors

Please include the full traceback of the error message. It often contains all important information to locate the cause of the problem.

Also, please give details on the modules/packages ApiResponseInvalidError and RequestsResp are imported from.

You can also check that e is picklable using the regular pickle.dumps and pickle.loads from the standard library. Assuming ApiResponseInvalidError and RequestsResp are not interactively defined classes but are imported from a module/package, then cloudpickle should be no better than the regular pickle module from the standard library of Python: if they are not picklable you need to fix that in the __reduce__ / __getstate__ / __setstate__ methods of that class, see: https://docs.python.org/3/library/pickle.html#pickling-class-instances

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