[Bug 1482303] Re: python 3.4.0's argparse ignores subcommand
Matthias Klose
doko at ubuntu.com
Sun May 8 16:11:35 UTC 2016
that's won't fix upstream
** Changed in: python3-defaults (Ubuntu)
Status: New => Won't Fix
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python3-defaults in Ubuntu.
https://bugs.launchpad.net/bugs/1482303
Title:
python 3.4.0's argparse ignores subcommand
Status in python3-defaults package in Ubuntu:
Won't Fix
Bug description:
Hi,
take this simple example:
```
#!/usr/bin/env python3
import argparse
def do_default(options):
print("default")
def do_build(options):
print("build")
if __name__ == '__main__':
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers()
parser.set_defaults(func=do_default)
build = subparsers.add_parser('build')
build.set_defaults(func=do_build)
options = parser.parse_args()
options.func(options)
```
On Ubuntu 14.04, without parameters it errors for missing command and
with the parameter "build" it prints "default", so the subcommand gets
ignored somehow.
If running this on ubuntu 15.04, it works as expected: Without
parameters, it prints "default". With the parameter "build" it prints
"build".
I couldn't track that to any upstream bug report, but it seems like a
issue was fixed and the fix needs to get backported to ubuntu 14.04.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3-defaults/+bug/1482303/+subscriptions
More information about the foundations-bugs
mailing list