I use docopt for some time now and on a new script I cannot manage to pass through the argument parsing:
# coding=utf-8
"""
API server for the infoscreen frontends
Usage:
    python3 webserver.py [options]
Options:
    --bind ADDRESS  address to bind to  [default: 0.0.0.0]
    --galarmclock URL  URL for the galarmclock API [default: http://10.100.10.202:8082]
    --loglevel LOG  logging level   [default: logging.DEBUG]
    --console   log to console [default: False]
    --syslog    log to syslog [default: False]
"""
import docopt
# process arguments
args = docopt.docopt(__doc__)
print(args)
All paramters (arguments) are optional and have a default so why does the script stops?
C:\Python3\python.exe C:/tst.py
Usage:
    python3 webserver.py [options]
Process finished with exit code 1
				
                        
The problem lies in the usage part:
Docopt expects the first string in the usage part to be your program, and not python. So docopt will interpret this as
python3being your program, and that it always takes a command that is calledwebserver.py. If you remove thepython3part it should work fine like this:From docopt's documentation we have: