Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-9433

ds9.py error code not working as intended

    Details

    • Type: Bug
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: afw
    • Story Points:
      0.5
    • Epic Link:
    • Sprint:
      Alert Production S17 - 2
    • Team:
      Alert Production

      Description

      The following code in afw's display/ds9.py appears to not function as intended:

          except Exception as e:
              # No usable version of display_ds9.
              # Let's define a version of getDisplay() which will throw an exception.
              e.args = ["%s (is display_ds9 setup?)" % e]
       
              def getDisplay(*args, **kwargs):
                  raise e
       
              class DisplayImpl(object):
                  def __init__(self, *args, **kwargs):
                      raise e
      

      To see this run examples/estimateBackground.py with display_ds9 not set up. What I see is:

      Traceback (most recent call last):
        File "examples/estimateBackground.py", line 109, in <module>
          main()
        File "examples/estimateBackground.py", line 89, in main
          ds9.mtv(image, frame=0)
        File "/Users/rowen/UW/LSST/lsstsw3/build/afw/python/lsst/afw/display/ds9.py", line 84, in mtv
          return getDisplay(frame, create=True).mtv(data, title, wcs, *args, **kwargs)
        File "/Users/rowen/UW/LSST/lsstsw3/build/afw/python/lsst/afw/display/ds9.py", line 46, in getDisplay
          raise e
      NameError: name 'e' is not defined
      

      I confess to some surprise. I am not an expert on Python's binding rules, but I expected the code to work.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rowen Russell Owen
                Reporter:
                rowen Russell Owen
                Reviewers:
                Tim Jenness
                Watchers:
                Russell Owen, Tim Jenness
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel