Reputation: 1293
I made a class in python like the following:
class myClass():
_fields_ = [1, 2]
where field_1 & field_2 are supposed to be integers.
Then I created an array that its elements are of the class myClass
as following:
array = [ myClass() for i in range(5)]
When I wanted to check the values of the elements of array
in the variable inspector, it gives my the following message:
"Spyder was unable to retrieve the value of this variable from the console."
"The error message was: Object array is not picklable"
My question is: How can I check the values of the elements of the array?
Upvotes: 2
Views: 4106
Reputation: 15513
Check out the following Spyder related sites:
Verifyed, pickle
can handle object array
given in Question.
The following works without failure.
pick_array = pickle.dumps(array)
unpick_array = pickle.loads(pick_array)
Tested with Python:3.4.2
To verify your Spyder is able to show a array
at all, check the following:
array = [ i for i in range(5)]
Try to show the variable array
with Inspector.
If you are able to view the variable, it's a limitation from your Spyder Version to handle object array.
Upvotes: 1