29a.ch by Jonas Wagner

PyGST messing with sys.argv

While developing play it slowly I noticed some strange behavior of the python gstreamer bindings. For some reason pygst parses argv on import. This illustrates the problem:
[veers@castle ~]$ python
Python 2.6.1 (r261:67515, Dec  7 2008, 08:27:41) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys.argv
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named argv
>>> import sys
>>> sys.argv.append("--help")
>>> import gst
  . [OPTION...] - GStreamer initialization

Help Options:
  -?, --help                        Show help options
  --help-all                        Show all help options
  --help-gst                        Show GStreamer Options
That's not nice of you pygst! But there's a simple workaround:
argv = sys.argv
sys.argv = []
import gst
sys.argv = argv
I guess I should write a patch instead of a post but.. may be later.