Moving end of owm CLI profiling to after output
Catches execution that happens in output generators
@@ -120,9 +120,6 @@ def main():
# In case someone forgets to add a helpful message for their user error
s = 'Received error: ' + FCN(type(e))
die(s)
- if environ.get('OWM_CLI_PROFILE'):
- profiler.disable()
- profiler.dump_stats(environ['OWM_CLI_PROFILE'])
output_mode = ns_handler.output_mode
text_field_separator = ns_handler.text_field_separator
text_record_separator = ns_handler.text_record_separator
@@ -217,6 +214,10 @@ def main():
else:
print(x, end=text_record_separator)
+ if environ.get('OWM_CLI_PROFILE'):
+ profiler.disable()
+ profiler.dump_stats(environ['OWM_CLI_PROFILE'])
+
if __name__ == '__main__':
main()
