# Buggy code
def parse_options():
    parser = optparse.OptionParser(version="Mopidy %s" % versioning.get_version())
    parser.add_option(
        "--help-gst",
        action="store_true",
        dest="help_gst",
        help="show GStreamer help options",
    )
    parser.add_option(
        "-i",
        "--interactive",
        action="store_true",
        dest="interactive",
        help="ask interactively for required settings which are missing",
    )
    parser.add_option(
        "-q",
        "--quiet",
        action="store_const",
        const=0,
        dest="verbosity_level",
        help="less output (warning level)",
    )
    parser.add_option(
        "-v",
        "--verbose",
        action="count",
        default=1,
        dest="verbosity_level",
        help="more output (debug level)",
    )
    parser.add_option(
        "--save-debug-log",
        action="store_true",
        dest="save_debug_log",
        help='save debug log to "./mopidy.log"',
    )
    parser.add_option(
        "--list-settings",
        action="callback",
        callback=settings_utils.list_settings_optparse_callback,
        help="list current settings",
    )
    parser.add_option(
        "--list-deps",
        action="callback",
        callback=deps.list_deps_optparse_callback,
        help="list dependencies and their versions",
    )
    parser.add_option(
        "--debug-thread",
        action="store_true",
        dest="debug_thread",
        help="run background thread that dumps tracebacks on SIGUSR1",
    )
    return parser.parse_args(args=mopidy_args)[0]


# Traceback (TypeError)
erik@faust:~$  mopidy
Traceback (most recent call last):
File "/usr/local/bin/mopidy", line 5, in <module>
main()
File "/usr/local/lib64/python2.6/site-packages/mopidy/__main__.py", line 48, in main
options = parse_options()
File "/usr/local/lib64/python2.6/site-packages/mopidy/__main__.py", line 85, in parse_options
help='show GStreamer help options')
File "/usr/lib64/python2.6/optparse.py", line 1012, in add_option
raise TypeError, "invalid arguments"
TypeError: invalid arguments
erik@faust:~$  python --version
Python 2.6
erik@faust:~$  uname -a
Linux faust 3.0.13-0.27-default #1 SMP Wed Feb 15 13:33:49 UTC 2012 (d73692b) x86_64 x86_64 x86_64 GNU/Linux
erik@faust:~$  cat /etc/SuSE-release
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 2
erik@faust:~$

# Fixed code
def parse_options():
    parser = optparse.OptionParser(version="Mopidy %s" % versioning.get_version())
    # NOTE Python 2.6: To support Python versions < 2.6.2rc1 we must use
    # bytestrings for the first argument to ``add_option``
    # See https://github.com/mopidy/mopidy/issues/302 for details
    parser.add_option(
        b"--help-gst",
        action="store_true",
        dest="help_gst",
        help="show GStreamer help options",
    )
    parser.add_option(
        b"-i",
        "--interactive",
        action="store_true",
        dest="interactive",
        help="ask interactively for required settings which are missing",
    )
    parser.add_option(
        b"-q",
        "--quiet",
        action="store_const",
        const=0,
        dest="verbosity_level",
        help="less output (warning level)",
    )
    parser.add_option(
        b"-v",
        "--verbose",
        action="count",
        default=1,
        dest="verbosity_level",
        help="more output (debug level)",
    )
    parser.add_option(
        b"--save-debug-log",
        action="store_true",
        dest="save_debug_log",
        help='save debug log to "./mopidy.log"',
    )
    parser.add_option(
        b"--list-settings",
        action="callback",
        callback=settings_utils.list_settings_optparse_callback,
        help="list current settings",
    )
    parser.add_option(
        b"--list-deps",
        action="callback",
        callback=deps.list_deps_optparse_callback,
        help="list dependencies and their versions",
    )
    parser.add_option(
        b"--debug-thread",
        action="store_true",
        dest="debug_thread",
        help="run background thread that dumps tracebacks on SIGUSR1",
    )
    return parser.parse_args(args=mopidy_args)[0]