Skip to content

Commit a9d8720

Browse files
committed
The error log should only be generated when all the parameters (input, output, component list) are checked and validated.
1 parent 6298dc7 commit a9d8720

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

about_code_tool/genattrib.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,6 @@ def main(parser, options, args):
113113
reload(sys)
114114
sys.setdefaultencoding('utf-8')
115115

116-
# Clear the log file
117-
with open(join(dirname(output_path), LOG_FILENAME), 'w'):
118-
pass
119-
120-
file_handler = logging.FileHandler(join(dirname(output_path), LOG_FILENAME))
121-
file_logger.addHandler(file_handler)
122-
123116
if not exists(input_path):
124117
print('Input path does not exist.')
125118
parser.print_help()
@@ -148,6 +141,13 @@ def main(parser, options, args):
148141
with open(output_path, "w") as f:
149142
f.write(attrib_str)
150143
errors = collector.get_genattrib_errors()
144+
145+
# Clear the log file
146+
with open(join(dirname(output_path), LOG_FILENAME), 'w'):
147+
pass
148+
149+
file_handler = logging.FileHandler(join(dirname(output_path), LOG_FILENAME))
150+
file_logger.addHandler(file_handler)
151151
for error_msg in errors:
152152
logger.error(error_msg)
153153
file_logger.error(error_msg)

0 commit comments

Comments
 (0)