fix rfopenskin.py, "local variable 'xray_filter_type' referenced before assignment"

Issue #451 resolved
ramiromoreno
created an issue

Hi, I want to validate SR available from GE DISCOVERY system (SR attach to this issue). But when I try to export the CSV (for OPENSKIN) from OPENREM, the script rfopenskin.py goes into a loop with log : raised unexpected: UnboundLocalError("local variable 'xray_filter_type' referenced before assignment",) Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 368, in trace_task R = retval = fun(args, kwargs) File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 623, in protected_call return self.run(args, kwargs) File "/usr/local/lib/python2.7/dist-packages/openrem/remapp/exports/rf_export.py", line 1156, in rfopenskin xray_filter_type, UnboundLocalError: local variable 'xray_filter_type' referenced before assignment

try:
        for filter in event.irradeventxraysourcedata_set.get().xrayfilters_set.all():
            try:
                if "Copper" in filter.xray_filter_material.code_meaning:
                    xray_filter_type = filter.xray_filter_type
                    xray_filter_material = filter.xray_filter_material
                    xray_filter_thickness_minimum = filter.xray_filter_thickness_minimum
                    xray_filter_thickness_maximum = filter.xray_filter_thickness_maximum
            except AttributeError:
                    xray_filter_type = ''
                    xray_filter_material = ''
                    xray_filter_thickness_minimum = ''
                    xray_filter_thickness_maximum = ''
    except ObjectDoesNotExist:
        xray_filter_type = ''
        xray_filter_material = ''
        xray_filter_thickness_minimum = ''
        xray_filter_thickness_maximum = ''

Do you have any idea how to correct this problem ? Do you have any other SR to test ?

Comments (5)

  1. Log in to comment