Export to NM fails with UnboundLocalError

Issue #1015 new
Ed McDonagh created an issue

Not yet investigated, but exports to NM on production system currently failing with:

[12/Mar/2024 15:03:25] ERROR [remapp.exports.nm_export:75] Failed to export NM with error:
 Traceback (most recent call last):
  File "/var/dose/veopenrem3/lib/python3.10/site-packages/openrem/remapp/exports/nm_export.py", line 518, in exportNM2excel
    create_summary_sheet(task, data, book, summary, None, False)
  File "/var/dose/veopenrem3/lib/python3.10/site-packages/openrem/remapp/exports/export_common.py", line 880, in create_summary_sheet
    for x in sorted_protocols
UnboundLocalError: local variable 'sorted_protocols' referenced before assignment

Comments (1)

  1. Ed McDonagh reporter

    sorted_protocols is called on line 880 of export_common, in the create_summary_sheet routine, if enable_standard_names is True.

    However, it is only assigned if has_series_protocol is true on line 839 of the same function.

    When create_summary_sheet is called from exportNM2excel in nm_export, has_series_protocol is set to False. Therefore it appears that this can never work.

  2. Log in to comment