code: def test_write_frame_errors_with_redirected_logs(util, video):
      """Checks error cases return helpful messages even when logs redirected.
      See https://github.com/Zulko/moviepy/issues/877
      """
      clip = video()
      location = os.path.join(util.TMP_DIR, "logged-write.mp4")
      with pytest.raises(IOError) as e:
          clip.write_videofile(
              location, codec="nonexistent-codec", write_logfile=True
          )
      assert (
          "The video export failed because FFMPEG didn't find the specified"
          " codec for video encoding nonexistent-codec" in str(e.value)
      )
  
      autogenerated_location_mp3 = "logged-writeTEMP_MPY_wvf_snd.mp3"
      autogenerated_location_log = autogenerated_location_mp3 + ".log"
      for fp in [
          autogenerated_location_mp3,
          autogenerated_location_log,
      ]:
          if os.path.exists(fp):
              os.remove(fp)
  
imports: import copy
  import os
  import numpy
  from PIL import Image
  import pytest
  from moviepy.audio.AudioClip import AudioClip
  from moviepy.audio.io.AudioFileClip import AudioFileClip
  from moviepy.tools import convert_to_seconds
  from moviepy.video.compositing.CompositeVideoClip import CompositeVideoClip
  from moviepy.video.fx.mask_color import mask_color
  from moviepy.video.fx.multiply_speed import multiply_speed
  from moviepy.video.io.VideoFileClip import VideoFileClip
  from moviepy.video.VideoClip import BitmapClip, ColorClip, ImageClip, VideoClip
label_desc: Use image node_id 7 for calling a global function with example usage: test_write_frame_errors_with_redirected_logs(util, video) without return types