mirror of
https://github.com/robmcmullen/atrcopy.git
synced 2024-11-29 11:51:14 +00:00
Refs #8: added some error checking for templates without .inf files
This commit is contained in:
parent
6ea00e263e
commit
4185ca5617
@ -305,10 +305,15 @@ def get_template_info():
|
||||
try:
|
||||
with open(name + ".inf", "r") as fh:
|
||||
s = fh.read()
|
||||
try:
|
||||
j = json.loads(s)
|
||||
except ValueError:
|
||||
continue
|
||||
description = j["description"]
|
||||
except IOError:
|
||||
description = ""
|
||||
if not description:
|
||||
continue
|
||||
d = textwrap.wrap(description, 80 - 1 - 14 - 2 - 2)
|
||||
lines.append(fmt % (os.path.basename(name), d[0]))
|
||||
lines.extend([fmt % ("", line) for line in d[1:]])
|
||||
|
Loading…
Reference in New Issue
Block a user