Skip to content

Comments

parse_log.py bugfix: don't attempt to write CSV if there are no lines to write#3292

Merged
shelhamer merged 1 commit intoBVLC:masterfrom
dgolden1:log-parse-no-test
Mar 7, 2016
Merged

parse_log.py bugfix: don't attempt to write CSV if there are no lines to write#3292
shelhamer merged 1 commit intoBVLC:masterfrom
dgolden1:log-parse-no-test

Conversation

@dgolden1
Copy link
Contributor

@dgolden1 dgolden1 commented Nov 5, 2015

An empty dict_list, which contains the contents of the to-be-written CSV, can occur if, e.g., testing is never performed in the log.

Previously, this yielded an error like:

Traceback (most recent call last):
  File "./parse_log.py", line 201, in <module>
    main()
  File "./parse_log.py", line 197, in main
    test_dict_list, delimiter=args.delimiter)
  File "./parse_log.py", line 146, in save_csv_files
    write_csv(test_filename, test_dict_list, delimiter, verbose)
  File "./parse_log.py", line 161, in write_csv
    dict_writer = csv.DictWriter(f, fieldnames=dict_list[0].keys(),
IndexError: list index out of range

This can happen if, e.g., testing never occurs in the log
@dgolden1
Copy link
Contributor Author

dgolden1 commented Mar 7, 2016

@shelhamer any interest in merging this minor log parser patch?

@shelhamer shelhamer closed this Mar 7, 2016
@shelhamer shelhamer reopened this Mar 7, 2016
@shelhamer
Copy link
Member

Sure, thanks for the patch.

shelhamer added a commit that referenced this pull request Mar 7, 2016
parse_log.py bugfix: don't attempt to write CSV if there are no lines to write
@shelhamer shelhamer merged commit 6ed3b2a into BVLC:master Mar 7, 2016
fxbit pushed a commit to Yodigram/caffe that referenced this pull request Sep 1, 2016
parse_log.py bugfix: don't attempt to write CSV if there are no lines to write
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants