System information
To reproduce on Big Sur and most probably older versions:
import multiprocessing as mp
if __name__ == '__main__':
exp_queue = mp.Queue()
print(exp_queue.qsize())
Results in:
File "/Users/username/Library/Application Support/JetBrains/PyCharm2020.3/scratches/scratch.py", line 5, in <module>
print(exp_queue.qsize())
File "/usr/local/Cellar/[email protected]/3.8.7/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/queues.py", line 120, in qsize
return self._maxsize - self._sem._semlock._get_value()
NotImplementedError
It looks like whoever wrote this in multiprocessing/queues.py line 120
is aware of the issue, but I can't find a solution somewhere:
def qsize(self):
# Raises NotImplementedError on Mac OSX because of broken sem_getvalue()
return self._maxsize - self._sem._semlock._get_value()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…