diff --git a/md2zhihu/__init__.py b/md2zhihu/__init__.py index 63effed..e0cda3c 100644 --- a/md2zhihu/__init__.py +++ b/md2zhihu/__init__.py @@ -9,6 +9,7 @@ import k3git import urllib3 import yaml +from k3color import darkred from k3color import darkyellow from k3color import green from k3handy import cmdpass @@ -1638,6 +1639,7 @@ def main(): stat = [] for path in args.src_path: + # TODO Config should accept only two arguments: the path and a args conf = Config( path, @@ -1655,6 +1657,13 @@ def main(): embed=args.embed, ) + # Check if file exists + try: + fread(conf.src_path) + except FileNotFoundError as e: + msg(darkred(sj("Warn: file not found: ", repr(conf.src_path)))) + continue + convert_md(conf) msg(sj("Done building ", darkyellow(conf.md_output_path)))