mirror of
https://github.com/robmcmullen/atrcopy.git
synced 2024-12-02 00:51:41 +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:
|
try:
|
||||||
with open(name + ".inf", "r") as fh:
|
with open(name + ".inf", "r") as fh:
|
||||||
s = fh.read()
|
s = fh.read()
|
||||||
|
try:
|
||||||
j = json.loads(s)
|
j = json.loads(s)
|
||||||
|
except ValueError:
|
||||||
|
continue
|
||||||
description = j["description"]
|
description = j["description"]
|
||||||
except IOError:
|
except IOError:
|
||||||
description = ""
|
description = ""
|
||||||
|
if not description:
|
||||||
|
continue
|
||||||
d = textwrap.wrap(description, 80 - 1 - 14 - 2 - 2)
|
d = textwrap.wrap(description, 80 - 1 - 14 - 2 - 2)
|
||||||
lines.append(fmt % (os.path.basename(name), d[0]))
|
lines.append(fmt % (os.path.basename(name), d[0]))
|
||||||
lines.extend([fmt % ("", line) for line in d[1:]])
|
lines.extend([fmt % ("", line) for line in d[1:]])
|
||||||
|
Loading…
Reference in New Issue
Block a user