pygobject / pgi

[Unmaintained: Use PyGObject instead] GTK+ / GObject Introspection Bindings for PyPy.
GNU Lesser General Public License v2.1
74 stars 16 forks source link

Can't call Gst.init with no parameters #44

Closed aliyilmazz closed 6 years ago

aliyilmazz commented 6 years ago

Hello, I needed to use gi libraries in python3.6 and I came across your library, and I decided to use it. So here is my code:

import pgi
pgi.install_as_gi()
import gi 
## in order to verify that gi belongs to pgi, here is the testcode:
## >>> print(gi)
## <module 'pgi' from '/usr/local/lib/python3.6/dist-packages/pgi/__init__.py'>
gi.require_version('Gst', '1.0')
gi.require_version('GstController', '1.0')
from gi.repository import Gst
Gst.init(None)
command = "filesrc location=/home/yilmazali/Downloads/video.wmv ! decodebin ! videoscale ! video/x-raw,width=400,height=300 ! x264enc ! queue2 ! mpegtsmux ! filesink location=/home/yilmazali/videoedited.wmv"
pipeline = Gst.parse_launch(command)
print("Starting operation...")
pipeline.set_state(Gst.State.PLAYING)
print("Operation completed!")

I have used this code in a python3.5 environment, using gi libraries. However, I couldn't make gi work on python3.6 so I wanted to use your pgi library. At the code above, Gst.init(None) gives error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 5, in init
TypeError: object of type 'NoneType' has no len()

can you help me with this? I would appreciate any feedback. Thank you for your time.

lazka commented 6 years ago

Gst.init([]) might work

aliyilmazz commented 6 years ago

Thank you for the feedback. I'll test it and edit this message with results once I get home.

Edit: it works, thanks again. However, in my humble opinion, calling Gst.init with args=None should be possible since original gi library accepts it that way.

lazka commented 6 years ago

@aliyilmazz this library is currently unmaintained, so don't expect any fixes.