Ask Your Question

OpenCV Python Script Mac "aborts"

asked 2018-10-03 11:23:35 -0500

updated 2018-10-03 13:57:39 -0500

So I'm just trying to run the basic OpenCV program

import numpy as np
import cv2

cap = cv2.VideoCapture(0)

    # Capture frame-by-frame
    ret, frame =

    # Our operations on the frame come here
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2BGRA)

    # Display the resulting frame
    if cv2.waitKey(1) & 0xFF == ord('q'):

# When everything done, release the capture

But for some reason when I try to run it (with python 2 or 3) I get this weird abort statement

[1]    74309 abort      python3

(I'm guessing the 5 digit number is the PID) However, it does work if I pass in a path to an already existing video in the VideoCapture function. I am a beginner in all of this so I'm not really sure what the problem is

Thanks :)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-10-04 15:56:31 -0500

I found the solution! I tried running the script using the default terminal that comes with mac and it worked :) So it seems there was some weird issue with the third party terminal (iTerm) I was using

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-10-03 11:23:35 -0500

Seen: 614 times

Last updated: Oct 03 '18