[英]Getting Python error -->PermissionError: [WinError 32] The process cannot access the file because it is being used by another process
[英]Python PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: mp4 file
我目前收到此错误 PermissionError: [WinError 32] 该进程无法访问该文件,因为它正被另一个进程使用:'smallvideos/file1.mp4'
我尝试了不同的方法来关闭文件,但没有运气,不知道我在这里做错了什么。
def create_file(today):
list_of_clips = []
with open("video_names.txt") as clip_file:
read_file = clip_file.read()
lines = read_file.splitlines()
clip_file = open("video_names.txt")
for line in lines:
#Creates video in 720p - keeps original aspect ratio
video = VideoFileClip(line, target_resolution=(720, None))
list_of_clips.append(video)
os.remove(line)
filename = "combinedVideo_" + str(today) + ".mp4"
final_clip = concatenate_videoclips(list_of_clips, method='compose')
final_clip.write_videofile(filename)
return filename
这基本上是权限错误,您只需要在删除它之前关闭文件。 获取文件大小信息后。
clip_file.close()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.