Public bug reported: 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. ** Affects: python3-defaults (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, 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: New 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 -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp