docopt / try.docopt.org

Try out docopt in browser (Flask app running on Heroku)
try.docopt.org
61 stars 16 forks source link

Platform specfic parse issues #5

Open editasmed opened 9 years ago

editasmed commented 9 years ago

Hi ,

I have a docopt string like

"""Get PAM list Usage: list_vals_for_prot_sp.py <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

keleshev commented 9 years ago

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 commented 9 years ago

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

editasmed commented 9 years ago

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.

keleshev commented 9 years ago

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.