mirror of https://github.com/patacrep/patacrep.git
Oliverpool
9 years ago
3 changed files with 18 additions and 21 deletions
@ -0,0 +1,13 @@ |
|||
"""Common functions for patatools""" |
|||
|
|||
import argparse |
|||
import os |
|||
|
|||
def existing_file(name): |
|||
"""Check that argument is an existing, readable file name. |
|||
|
|||
Return the argument for convenience. |
|||
""" |
|||
if os.path.isfile(name) and os.access(name, os.R_OK): |
|||
return name |
|||
raise argparse.ArgumentTypeError("Cannot read file '{}'.".format(name)) |
Loading…
Reference in new issue