I'm converting a source code written in Python 2 to Python 3 and I stumbled into this:
from Queue import Queue, Empty
I changed it to:
from multiprocessing import Queue, Empty
But this gives me an exception:
ImportError: cannot import name 'Empty'
How do I fix this?
multiprocessing.Queue is used for processes, don't let the capitalization confuse you. Queue, which was renamed to queue in Python 3, is for threads.
Both Empty and Queue are located in the queue module, so grab them from there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With