"import pygst" compromises use of optparse

Dan danmbox at gmail.com
Fri Nov 15 02:21:52 PST 2013


Hi, I have a program that needs to run on Python 2.5, therefore I'd
like to use optparse. Now,

---
from optparse import OptionParser
parser = OptionParser(usage = "%prog [options] [ filename ]", version
= "%prog 1.0")
(options, args) = parser.parse_args()

import pygst; pygst.require("0.10")
import gst
---

produces the (correct) -h help message

---
Usage: x.py [options] [ filename ]

Options:
  --version   show program's version number and exit
  -h, --help  show this help message and exit
---

While

---
from optparse import OptionParser
import pygst; pygst.require("0.10")
import gst

parser = OptionParser(usage = "%prog [options] [ filename ]", version
= "%prog 1.0")
(options, args) = parser.parse_args()
---

produces

---
Usage:
  x.py [OPTION...] - GStreamer initialization

Help Options:
  -h, --help                        Show help options
  --help-all                        Show all help options
  --help-gst                        Show GStreamer Options
---

So pygst (or gst) seem to compromise usage of optparse unless you
parse options before anything else. Is there a way to avoid this
behavior?


More information about the gstreamer-devel mailing list