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: can't pickle odict_items objects in python 3.5 #560
Comments
Hi @dangusev. Initial reaction is that it doesn't make sense. Two thoughts:
|
Sorry, my bad). I have a lot of code like this: category = ChoiceField(choices=CATEGORIES.items()) When copy.deepcopy() is being called on self.base_fields it tries to pickle choices of fields and fails, because choices have type dict_items. |
For those still running into this issue, I solved it like so:
|
[With Python 3.85 and Django 3.1.1] Similarly, I’m getting this error in one of my list views:
Nothing in the backtrace is in my code: Turns out the problem was adding a fails:
works ok:
Assigning that same this works:
Can someone explain what's going on? |
@paulschreiber in your situation Hopefully, that explains it in good form, it's been a few years since I last looked at this. |
@Ryanb58 I don't understand why it fails only for this field, but works for all other fields in my various models. In each case, I'm reading in a JSON file that's a dictionary. |
@paulschreiber I'm interested in the problem but also don't want to blow up this thread. Sounds like it might be something outside the scope of this specific project. I'll shoot you an email. |
Hello, I caught an error during instantiation of FilterSet-derived class in python>=3.5. In 3.4 everything works ok.
Example of my FilterSet class. Fields DateTimeFIlter and CommaSeparatedCharFilter are custom:
The text was updated successfully, but these errors were encountered: