Receiving "TypeError: cannot pickle '_thread.lock' object" with providers.Factory #718
Unanswered
chriscoindeskindices
asked this question in
Q&A
Replies: 1 comment
-
You cannot pass the Redis object directly (or whatever other object). Instead, you need to wrap it with a It would be something like this
Hope it helps. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using providers.Factory to create a service, and one of the dependencies is a class to interact with our Redis database.
This line in the code seems to be the offender:
self._client = redis.Redis(host=host, port=port, password=password, db=db, health_check_interval=health_check_interval)
that code is executing in the constructor. if I remove that line or if I change it to
client = redis.Redis(host=host, port=port, password=password, db=db, health_check_interval=health_check_interval)
which doesn't help me but just an observation--then there is no error. I understand what pickling is, but I don't understand what is going on here exactly.
Beta Was this translation helpful? Give feedback.
All reactions