Comment 0 for bug 1424277

Revision history for this message
Miro HronĨok (churchyard) wrote :

I'm trying to run the current trunk on Python 3. When I run cloud-init with no arguments, I get the following exception.

    $ python3 bin/cloud-init
    Traceback (most recent call last):
      File "bin/cloud-init", line 623, in <module>
        sys.exit(main())
      File "bin/cloud-init", line 614, in main
        (name, functor) = args.action
    AttributeError: 'Namespace' object has no attribute 'action'

This is caused by a chenge of behavior of argparse on Python 3 when using subparsers.

Can we workarounded by adding try-catch similar to this one:

        try:
            (name, functor) = args.action
        except AttributeError:
            parser.print_help()
            return 0

(Consider it public domain, as it is so simple)