mirror of https://github.com/wanadev/yoga.git
Fixes issue when output file does not already exists
This commit is contained in:
parent
2fced9a27f
commit
28a28dac8d
12
yoga/cli.py
12
yoga/cli.py
|
@ -7,9 +7,15 @@ from .model.cli import add_model_cli_options
|
|||
|
||||
|
||||
def _type_path(mode, string):
|
||||
if os.access(string, mode):
|
||||
return string
|
||||
raise argparse.ArgumentTypeError("can't access '%s'" % string)
|
||||
if os.path.isfile(string):
|
||||
if os.access(string, mode):
|
||||
return string
|
||||
raise argparse.ArgumentTypeError("can't access '%s'" % string)
|
||||
else:
|
||||
path = os.path.dirname(os.path.abspath(string))
|
||||
if os.access(path, mode):
|
||||
return string
|
||||
raise argparse.ArgumentTypeError("the '%s' folder does not exist" % path) # noqa
|
||||
|
||||
|
||||
def add_main_cli_arguments(parser):
|
||||
|
|
Loading…
Reference in New Issue