[英]Fatal Python error: could not acquire lock for <_io.BufferedReader name=8> at interpreter shutdown, possibly due to daemon threads
Running the following:运行以下:
import imageio
class vidrdf:
def __init__(self, vidfile):
self.vid = imageio.get_reader(vidfile, 'ffmpeg')
vidfile = 'movie.mov'
rdfobj = vidrdf(vidfile)
I get:我得到:
Fatal Python error: could not acquire lock for <_io.BufferedReader name=8> at interpreter shutdown, possibly due to daemon threads
Thread 0x00007fd2dc2a8700 (most recent call first):
File “/path/miniconda3/envs/flower/lib/python3.7/site-packages/imageio_ffmpeg/_parsing.py", line 61 in run
File "miniconda3/envs/flower/lib/python3.7/threading.py", line 926 in _bootstrap_inner
File “/path/miniconda3/envs/flower/lib/python3.7/threading.py", line 890 in _bootstrap
Current thread 0x00007fd2f0bb9700 (most recent call first):
File “/path/miniconda3/envs/flower/lib/python3.7/subprocess.py", line 1704 in _communicate
File “/path/miniconda3/envs/flower/lib/python3.7/subprocess.py", line 939 in communicate
File “/path/miniconda3/envs/flower/lib/python3.7/site-packages/imageio_ffmpeg/_io.py", line 193 in read_frames
File “/path/miniconda3/envs/flower/lib/python3.7/site-packages/imageio/plugins/ffmpeg.py", line 342 in _close
File “/path/miniconda3/envs/flower/lib/python3.7/site-packages/imageio/core/format.py", line 252 in close
File “/path/miniconda3/envs/flower/lib/python3.7/site-packages/imageio/core/format.py", line 241 in __del__
Aborted (core dumped)
It doesn't happen if I try:如果我尝试,它不会发生:
import imageio
class vidrdf:
def __init__(self, vidfile):
self.vid = imageio.get_reader(vidfile, 'ffmpeg')
vidfile = 'movie.mov'
vidrdf(vidfile)
or或者
import imageio
class vidrdf:
def __init__(self, vidfile):
vid = imageio.get_reader(vidfile, 'ffmpeg')
vidfile = 'movie.mov'
rdfobj = vidrdf(vidfile)
So this is clearly an issue with copying the object.所以这显然是复制 object 的问题。 I've searched about daemon threads, but since I'm using imageio directly I can't figure out why and how to resolve it.
我搜索了守护线程,但由于我直接使用 imageio,我无法弄清楚为什么以及如何解决它。 I would appreciate any recommendations.
我将不胜感激任何建议。
The following seems to work, although I don't know why:以下似乎有效,虽然我不知道为什么:
import imageio
import copy
class vidrdf:
def __init__(self, vidfile):
vid = imageio.get_reader(vidfile, 'ffmpeg')
self.vid = copy.copy(vid)
vidfile = 'movie.mov'
rdfobj = vidrdf(vidfile)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.