[Tutor] docopt module: defaults appear to be ignored
Steven D'Aprano
steve at pearwood.info
Wed Oct 9 03:02:59 CEST 2013
On Tue, Oct 08, 2013 at 05:50:15PM -0700, Alex Kleider wrote:
>
> A recent post recommended the docopt module so I've incorporated it into
> the code I'm using to learn SQLite. It's not behaving as I expected.
Since docopt is not a standard part of Python, nor part of the language
itself, you may not find anyone here who knows it well enough to solve
the problem. Also keep in mind that docopt is still a fairly young
package and may still contain bugs. If we can't help, you should try a
dedicated docopt mailing list, if any, or try contacting the developer.
I haven't actually used docopt, but I'm willing to try to help...
> """Usage: test [new_data | text_entry FILE | show_data ] [-hdv]
> [--db=DATABASE] [--tb=TABLE]
>
> -h --help show this
> -d --debug show debugging statements
> -v --verbose shows table when not absolutely necessary.
> --db DATABASE specify database file to use [default: ./uwomeds68.db]
> --tb TABLE specify table to use [default: matesTb]
The defaults for --db and --tb aren't valid Python objects. Perhaps you
need to specify them as strings?
--db DATABASE specify database file to use [default: './uwomeds68.db']
--tb TABLE specify table to use [default: 'matesTb']
--
Steven
More information about the Tutor
mailing list