pythondjangooserror

Errno 5 Input/output error when closing console


I have a video converter which is converting audio and video files. Everything works but if I close my terminal from my server the audio file convert doesnt work anymore. I use PyTube for converting and moviepy for converting the mp4 from pytube into mp3. (I think the problem has something to do with moviepy bc. before I didnt have it.)

This is my code for converting audio:

        if format == "3":
            yt = YouTube(videolink)
            downloads = MEDIA_ROOT + "/videos/"
            ys = yt.streams.filter(file_extension='mp4').first().download(downloads)
            base, ext = os.path.splitext(ys)
            basename = os.path.basename(base + uuid + '.mp3')
            videoclip = VideoFileClip(ys)
            audioclip = videoclip.audio
            audioclip.write_audiofile(base + uuid + ".mp3")
            audioclip.close()
            videoclip.close()

maybe something with the os code is wrong.

But I cant figure out why it works if I leave the console open.

Im thankful for every help I get.


Solution

  • So I found the solution, for everyone who faces the same problem. You have to disable the console output in moviepy. You can do the with the logger parameter in the "write" function. Then the error should disappear.