Segementation fault when running the default board's camera gstreamer pipeline through opencv 4.1.1 python

The Pipeline is as follows:

self.gst_str = "nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)30/1  ! nvvidconv ! video/x-raw,format=(string)I420  ! appsink";

I am running it through this:

cap = cv2.VideoCapture(self.gst_str)

        cap.set(3,1280)
        cap.set(4, 720)
        frame_size = (cap.get(cv2.CAP_PROP_FRAME_WIDTH),
                        cap.get(cv2.CAP_PROP_FRAME_HEIGHT))

And the error i’m getting after running is this:

GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 2592 x 1944 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 16.000000; Exposure Range min 34000, max 550385000;

GST_ARGUS: 2592 x 1458 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 16.000000; Exposure Range min 34000, max 550385000;

GST_ARGUS: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; Analog Gain range min 1.000000, max 16.000000; Exposure Range min 22000, max 358733000;

GST_ARGUS: Running with following settings:
   Camera index = 0 
   Camera mode  = 2 
   Output Stream W = 1280 H = 720 
   seconds to Run    = 0 
   Frame Rate = 120.000005 
GST_ARGUS: PowerService: requested_clock_Hz=12096000
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
[ WARN:0] global /media/jetson-tx2/0C62B20F62B1FE10/opencv/opencv-4.1.1/modules/videoio/src/cap_gstreamer.cpp (933) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
Segmentation fault (core dumped)

Any help? I’m stumped

When running the nvargus-daemon service on another terminal alongside it, the program still crashes but python gives no segmentation fault and where the service is being hosted gives this error:

python3[18980]: Connection established (7F7FFF71D0)OFParserListModules: module list: /proc/device-tree/tegra-camera-platform/modules/module0
OFParserGetVirtualDevice: virtual device driver node not found in proc device-tree: /proc/device-tree/tegra-virtual-camera-platform/modules/module0/drivernode1
OFParserGetVirtualDevice: virtual device driver node not found in proc device-tree: /proc/device-tree/tegra-virtual-camera-platform/modules/module1/drivernode0
---- imager: No override file found. ----
=== python3[18980]: CameraProvider initialized (0x7f794416c0)(Argus) Error FileOperationFailed: Failed socket read: Connection reset by peer (in src/rpc/socket/common/SocketUtils.cpp, function readSocket(), line 79)
(Argus) Error FileOperationFailed:  (propagating from libs/rpc_socket_server/ServerSocketManager.cpp, function recvThreadCore(), line 185)
(Argus) Error FileOperationFailed:  (propagating from libs/rpc_socket_server/ServerSocketManager.cpp, function run(), line 58)
=== python3[18980]: Connection closed (7F7FFF71D0)=== python3[18980]: WARNING: CameraProvider was not destroyed before client connection terminated.=== python3[18980]:          The client may have abnormally terminated. Destroying CameraProvider...=== python3[18980]: CameraProvider destroyed (0x7f794416c0)=== python3[18980]: WARNING: Cleaning up 1 outstanding sessions...PowerServiceCore:handleRequests: timePassed = 809
=== python3[18980]: NOTE: Destroy all libargus objects before destroying the CameraProvider to avoid these warnings.=== python3[18980]: Connection cleaned up (7F7FFF71D0)=== python3[27997]: Connection established (7F7FFF71D0)OFParserListModules: module list: /proc/device-tree/tegra-camera-platform/modules/module0
OFParserGetVirtualDevice: virtual device driver node not found in proc device-tree: /proc/device-tree/tegra-virtual-camera-platform/modules/module0/drivernode1
OFParserGetVirtualDevice: virtual device driver node not found in proc device-tree: /proc/device-tree/tegra-virtual-camera-platform/modules/module1/drivernode0
---- imager: No override file found. ----
=== python3[27997]: CameraProvider initialized (0x7f7943ea30)(Argus) Error FileOperationFailed: Failed socket read: Connection reset by peer (in src/rpc/socket/common/SocketUtils.cpp, function readSocket(), line 79)
(Argus) Error FileOperationFailed:  (propagating from libs/rpc_socket_server/ServerSocketManager.cpp, function recvThreadCore(), line 185)
(Argus) Error FileOperationFailed:  (propagating from libs/rpc_socket_server/ServerSocketManager.cpp, function run(), line 58)
=== python3[27997]: Connection closed (7F7FFF71D0)=== python3[27997]: WARNING: CameraProvider was not destroyed before client connection terminated.=== python3[27997]:          The client may have abnormally terminated. Destroying CameraProvider...=== python3[27997]: CameraProvider destroyed (0x7f7943ea30)=== python3[27997]: WARNING: Cleaning up 1 outstanding sessions...PowerServiceCore:handleRequests: timePassed = 676
=== python3[27997]: NOTE: Destroy all libargus objects before destroying the CameraProvider to avoid these warnings.=== python3[27997]: Connection cleaned up (7F7FFF71D0)