-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File not closed after merging audio #101
Comments
I am not sure I understand the problem, what is exactly the code that produces the error and what is the error produced ? Also for the record can you give your Python version/System/moviepy version (I assume it's the last version). And a remark: you can directly write
|
The problem is, I can't delete file after all work is done and it is no longer neaded. The file is opened by other process (I assume it is ffmpeg in the background) My code at the moment:
vc is VideoFileClip at the moment and I can not delete file from which it was created. Same applies to ac. Those are both temporary files and I would like delete those immediatly. |
This works fine for me (if I add os.remove(audio_file) at the end it will remove the audio file without problem, even if I don't write all the "del"). Again: can you give a code that produces the error, a copy of the entire error, your OS, and your Python version ? Otherwise I can't help you. |
Ok, so in my code there is error as <= should be changed to >= this means I make loop instead of subclip. It revealed error. audio_loop made imposible to remove audio file
|
I have no problem, even with audio_loop. Maybe you can try to make me a very simple script so that I can reproduce the problem. And please give the error, I still don't know which error you really have. And your OS, and your Python version. |
Errors are:
Second one is just ignered exception in del: The problem is, handler and all looks just fine... Simple example code:
So this way I can not remove any of downloaded files. I checked if pytube left them open, and it did not. I used audio_loop and subclip, as this is one of usages for my final project. System: Microsoft Windows 7 Professional N [Version 6.1.7601] |
Using close_proc() and close() before del let me get rid of [WinError 6], but I was still getting [WinError 32]. As one last try I added wait() after terminate() and got rid of [WinError 32]. I made just some tries, but it might be it, and it might be help for problem in #73. I had to ad wait inside close_proc() and close() so, how about adding it to moviepy? |
Thanks for the potential fix ! It's strange, it looks like a potential different behaviour of the Subprocess module in Python3.4, The problem is that "wait()" also used to hang python forever in some systems, I'll investigate when I have time. |
Well it always have potential of creating deadlock. I might be testing my project in some different environments, so I will report any troubles with this change if faced. |
It's unclear to me if the suggested changes were added to MoviePy. Leaving this open for now. |
Closing files in moviepy has changed so much since 0.2.1.9.07 that this issue is no longer valid. Please re-open a new issue if this behaviour is still causing a problem. |
I was extracting audio from one clip to add it to another. Using temporary mp3 file felt bit useless so I tried to make it directly.
The only problem audio file is no longer needed so I try to delete it. I tried to do it same way I did it after extraction to mp3 file:
But it doesn't work here. This centipede is result of many unsuccesfull tries.
The text was updated successfully, but these errors were encountered: