try.docopt.org icon indicating copy to clipboard operation
try.docopt.org copied to clipboard

Platform specfic parse issues

Open editasmed opened this issue 10 years ago • 4 comments

Hi ,

I have a docopt string like

"""Get PAM list Usage: list_vals_for_prot_sp.py <length_guide> <sense|antisense|all> [--chrom=CHROM_NUM default is all] Options: -h --help Show this screen. """

This parses a command like the one given below on MacOSX running 2.7.6 and docopt 0.6.1 just fine. It fails completely and just shows me the help text on Ubuntu also running Python 2.7.6 and docopt 0.6.1. Everything is identical and I am wondering why the parser behavior changes between Linux and MacOSX.

python list_vals_for_prot_sp.py 22 all

Parses file : python 2.7.6 OSX Fails to parse : python 2.7.6 OSX

Thanks

editasmed avatar Jun 19 '15 17:06 editasmed

I suspect that at least one version of docopt that you are using is a pre-release version. Please submit md5 hashes of docopt.py file on both systems. On OS X you can use the built-in md5 utility. On Linux there's something else, I think it's called md5sum, but I might be wrong.

keleshev avatar Jun 20 '15 10:06 keleshev

Anyway, you need an empty line between usage-section and options-section. I suspect that that can fix it.

keleshev avatar Jun 20 '15 10:06 keleshev

For some reason the empty line did not fix it . The OSX and Linux "versions" had different checksums . I ended up uninstalling the failing Linux version and installing the OSX version in Linux. Its all working after that. Incidentally the test case also fails on the web version at try.docopt.org. I was wondering if it is possible to have a debug option so I know where the parse is failing.

editasmed avatar Jun 21 '15 14:06 editasmed

This works: http://try.docopt.org/?doc=Get+PAM+list%0D%0AUsage%3A%0D%0Alist_vals_for_prot_sp.py+%5B--chrom%3DCHROM_NUM+default+is+all%5D%0D%0A%0D%0AOptions%3A%0D%0A-h+--help+Show+this+screen.&argv=default+is+all+--chrom%3DFOO

Note that default is all are treated rightly as optional commands.

For the next release–debugability is the priority.

keleshev avatar Jun 22 '15 08:06 keleshev