<html><body>Hi,<br><br>thanks... that's exactly what I was affraid of :( I'll file a bugreport, but it won't help me much because I need to post error message..<br><br>Is there any way to do it using Gst.Message.new_custom? I tried to convert C code from gstmessage.c:<br><br> GstMessage *message;<br> GstStructure *structure;<br><br> structure = gst_structure_new_id (GST_QUARK (MESSAGE_ERROR),<br> GST_QUARK (GERROR), G_TYPE_ERROR, error,<br> GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);<br> message = gst_message_new_custom (GST_MESSAGE_ERROR, src, structure);<br><br>in Python as:<br><br>struct = Gst.Structure.new_id_empty(GLib.quark_from_string('GST_QUARK_MESSAGE_ERROR'))<br><br>val1 = GObject.Value()<br>val1.init(GObject.TYPE_ERROR)<br>val1.set_error(GLib.Error())<br>struct['GST_QUARK_GERROR'] = val1<br><br>val2 = GObject.Value()<br>val2.init(GObject.TYPE_STRING)<br>val2.set_string('abc')<br>struct['GST_QUARK_DEBUG'] = val2<br><br>e = Gst.Message.new_custom(Gst.MessageType.ERROR, o, struct)<br><br><br>but I'm stuck because GLib.GValue doesn't accept GLib.Error.. which is probably similar problem..<br><br>Is there any other way to post error message from Element in python?<br><br>Or perhaps I got it wrong and I should just "raise(GLib.Error(...))" ? but then I wouldn't be able to return Gst.FlowReturn.ERROR...<br><br><br><p>---------- Původní zpráva ----------<br>Od: Thibault Saunier <tsaunier@gnome.org><br>Komu: Discussion of the development of and with GStreamer <gstreamer-devel@lists.freedesktop.org><br>Datum: 29. 10. 2015 15:46:22<br>Předmět: Re: python binding - Gst.Message.new_error doesn't know how many
arguments it wants</p><br><blockquote>Hello,<br><br>I confirm there is a bug here, and I have the feeling that it is in<br>PyGObject which getting messed up because of the GError which it does<br>not know how to deal with (usually GError are out arguments and are<br>used by PyGObject to throw exceptions).<br><br>Please open a bug report :)<br><br>Regards,<br><br>Thibault<br><br>On Thu, Oct 29, 2015 at 12:56 PM, Jan Spurný <JSpurny@seznam.cz> wrote:<br>> Hi,<br>><br>> I encountered really weird behaviour of Gst.Message.new_error - according to<br>> documentation, it should accept 3 arguments - src, error and debug. But if I<br>> pass 3 arguments, it throws an exception complaining that it needs 2<br>> arguments. When I pass 2 arguments, it suddenly wants 3. I'm stuck, because I<br>> can't use it.<br>><br>> This is how to reproduce the behaviour:<br>><br>>>>> import gi<br>>>>> gi.require_version('Gst', '1.0')<br>>>>> from gi.repository import Gst<br>>>>> Gst.init(None)<br>> []<br>>>>> o = Gst.ElementFactory.make('fakesink')<br>>>>> e = Gst.Message.new_error(o, None, None)<br>> Traceback (most recent call last):<br>> File "<stdin>", line 1, in <module><br>> TypeError: new_error() takes exactly 2 arguments (3 given)<br>>>>> e = Gst.Message.new_error(o, None)<br>> Traceback (most recent call last):<br>> File "<stdin>", line 1, in <module><br>> TypeError: new_error() takes exactly 3 argument(s) (2 given)<br>>>>><br>><br>> Debian Linux 8.2 amd64, python2.7, gstreamer 1.4.4.0<br>><br>> Am I doing something wrong or am I forgetting something?<br>> _______________________________________________<br>> gstreamer-devel mailing list<br>> gstreamer-devel@lists.freedesktop.org<br>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel<br>_______________________________________________<br>gstreamer-devel mailing list<br>gstreamer-devel@lists.freedesktop.org<br>http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</blockquote></body></html>