Skip to content

Commit

Permalink
fix: skip inexistent file, instead of raising exception
Browse files Browse the repository at this point in the history
  • Loading branch information
drmingdrmer committed Nov 13, 2023
1 parent 273c380 commit 58c3c6a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions md2zhihu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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)))
Expand Down

0 comments on commit 58c3c6a

Please sign in to comment.