'Type' for argparse - checks that file exists but does not open.
(x)
| 226 | |
| 227 | |
| 228 | def extant_file(x): |
| 229 | """ |
| 230 | 'Type' for argparse - checks that file exists but does not open. |
| 231 | """ |
| 232 | if not os.path.exists(x): |
| 233 | # Argparse uses the ArgumentTypeError to give a rejection message like: |
| 234 | # error: argument input: x does not exist |
| 235 | raise argparse.ArgumentTypeError("{0} does not exist".format(x)) |
| 236 | return x |
| 237 | |
| 238 | |
| 239 | def link_file(src, target): |