[gstreamer-bugs] [Bug 625211] import gst acts on --help or -h in sys.argv, preempting __main__

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Thu Jan 13 15:07:22 PST 2011


https://bugzilla.gnome.org/show_bug.cgi?id=625211
  GStreamer | gst-python | unspecified

--- Comment #3 from Philippe Normand <phil at base-art.net> 2011-01-13 23:07:17 UTC ---
Review of attachment 178218:
 --> (https://bugzilla.gnome.org/review?bug=625211&attachment=178218)

You might want to del local_argv when done with it

::: gst/__init__.py.in
@@ -191,2 +191,3 @@
     pass

+# We want gstreamer to not hijack some options, as it will exit if it finds
htem,

typo htem :)

@@ -193,0 +193,8 @@
+# We want gstreamer to not hijack some options, as it will exit if it finds
htem,
+# namely --help, -h, and --version. We take them out of sys.argv, and will be
+# restoring them afterwards so the calling program sees them as supplied.
... 5 more ...

if option not in ('--help', '-h', '--version')

is easier to read and has the same effect.

@@ -193,0 +193,10 @@
+# We want gstreamer to not hijack some options, as it will exit if it finds
htem,
+# namely --help, -h, and --version. We take them out of sys.argv, and will be
+# restoring them afterwards so the calling program sees them as supplied.
... 7 more ...

except: pass is not a very good practice. What exception could be raised
exactly? That code looks fairly safe to me.

@@ -196,0 +208,6 @@
+# Restore the original command line if appropriate
+try:
+    if local_argv:
... 3 more ...

same question ;)

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.




More information about the Gstreamer-bugs mailing list