Segmentation fault on Python 3.6 when running GStreamer on OSX
Issue
I want to run an image processing pipeline that uses GStreamer to grab images from various video sources - files, RTSP, TCP GST streams, UDP streams, etc. I am trying to run the following code:
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst
Gst.init(None)
source = Gst.ElementFactory.make("videotestsrc", "source")
This last line fails with SIGSEGV
when I run it on OSX. How do I get GI to work with GStreamer on OSX and has anyone succeeded in doing this?
I have tried on my machine, on a colleague's machine, running 10.12 and 10.9 respectively - same error. I tried running it on three different skews of Raspberry Pi and two different Linux machines - works like a charm! So it seems like it is an OSX only issue.
This is a copy of my Stack Overflow post: https://stackoverflow.com/questions/49415335/segmentation-fault-on-python3-6-and-gobject-on-osx
To reproduce:
A way to reproduce would be to create a conda environment and install the following:
brew install gstreamer gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-plugins-base
conda create -n StackOverflowDisposableEnvironment python=3.6
conda install pygobject
Then provide the .typelib files to GIRepository by creating simlinks to their system-wide installations:
ln -s /usr/local/lib/girepository-1.0/*Gst*.typelib ~/anaconda3/envs/StackOverflowDisposableEnvironment/lib/girepository-1.0/
Activate the environment, if not already active:
source activate StackOverflowDisposableEnvironment
And then you can open a python prompt and copy-paste line by line.