Skip to content
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

Closing Preview window causes traceback because of broken pipe #2374

Open
jmansilla opened this issue Feb 14, 2025 · 0 comments
Open

Closing Preview window causes traceback because of broken pipe #2374

jmansilla opened this issue Feb 14, 2025 · 0 comments
Labels
bug Issues that report (apparent) bugs.

Comments

@jmansilla
Copy link

This simple snippet evidences the problem

from moviepy import VideoFileClip
clip = VideoFileClip(movie_path)
clip.preview()
clip.close()

While the video is been played, proceed to close the window.

Expected Behavior

Program closes silently

Actual Behavior

This traceback is printed

/Users/jmansilla/.virtualenvs/myproject/lib/python3.12/site-packages/imageio_ffmpeg/binaries/ffmpeg-macos-x86_64-v7.1 -i movie.mp4 -loglevel error -f image2pipe -vf scale=1280:720 -sws_flags bicubic -pix_fmt rgb24 -vcodec rawvideo -
Traceback (most recent call last):
  File "/Users/jmansilla/.virtualenvs/myproject/lib/python3.12/site-packages/moviepy/video/io/ffplay_previewer.py", line 59, in show_frame
    self.proc.stdin.write(img_array.tobytes())
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jmansilla/.virtualenvs/myproject/bin/mycommand", line 6, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/jmansilla/projects/repo/myproject/ui/cli.py", line 76, in main
    play_movie(movie_path)
  File "/Users/jmansilla/projects/repo/myproject/ui/cli.py", line 87, in play_movie
    clip.preview()
  File "/Users/jmansilla/.virtualenvs/myproject/lib/python3.12/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jmansilla/.virtualenvs/myproject/lib/python3.12/site-packages/moviepy/decorators.py", line 53, in requires_duration
    return func(clip, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jmansilla/.virtualenvs/myproject/lib/python3.12/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jmansilla/.virtualenvs/myproject/lib/python3.12/site-packages/moviepy/decorators.py", line 24, in convert_masks_to_RGB
    return func(clip, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jmansilla/.virtualenvs/myproject/lib/python3.12/site-packages/moviepy/video/VideoClip.py", line 632, in preview
    ffplay_preview_video(
  File "/Users/jmansilla/.virtualenvs/myproject/lib/python3.12/site-packages/moviepy/video/io/ffplay_previewer.py", line 126, in ffplay_preview_video
    previewer.show_frame(frame)
  File "/Users/jmansilla/.virtualenvs/myproject/lib/python3.12/site-packages/moviepy/video/io/ffplay_previewer.py", line 70, in show_frame
    raise IOError(error)
OSError: [Errno 32] Broken pipe

MoviePy error: FFPLAY encountered the following error while previewing clip :

 None

Steps and code to Reproduce the Problem

nothing to add

Used medias

none

Specifications

  • Python Version: 3.12
  • MoviePy Version: 2.1.2
  • Platform Name: macOs
@jmansilla jmansilla added the bug Issues that report (apparent) bugs. label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that report (apparent) bugs.
Projects
None yet
Development

No branches or pull requests

1 participant