Skip to content

Commit fb2c025

Browse files
fix warnings printing
1 parent e9634b5 commit fb2c025

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

schemascii/__main__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse
22
import sys
3+
import warnings
34
from . import render, __version__
45
from .errors import Error
56

@@ -49,10 +50,14 @@ def cli_main():
4950
text = sys.stdin.read()
5051
args.in_file = "<stdin>"
5152
try:
52-
result_svg = render(args.in_file, text, **vars(args))
53+
with warnings.catch_warnings(record=True) as captured_warnings:
54+
result_svg = render(args.in_file, text, **vars(args))
5355
except Error as err:
5456
print(type(err).__name__ + ":", err, file=sys.stderr)
5557
sys.exit(1)
58+
if captured_warnings:
59+
for warn in captured_warnings:
60+
print("warning:", warn.message, file=sys.stderr)
5661
if args.out_file == "-":
5762
print(result_svg)
5863
else:

0 commit comments

Comments
 (0)