Posts in 'Python'

Luca Lanziani

Python - validate command line args

Ok, in the last article I've shown you a tool to write a nice command line interface, but it doesn't help you on validation.

    level = int(args['--log-level'])
except ValueError:
    raise ArgsError('--log-level has to be a valid integer')

Manual validation? There is a much better way ...

Luca Lanziani

Python - command line interface

How to write a better command line interface with python...

Writing the Nth python shell script I found myself looking again at the documentation of argparse, A NIGHTMARE. After 15 minutes spent trying to understand how to use it I gave up.

Is in that moment that I've found ...