Skip to content

Commit

Permalink
Check if bands metadata field is present before printing [fixes #27].
Browse files Browse the repository at this point in the history
* spectral/graphics/spypylab.py (ImageView.__str__): Check that `bands`
  is present in the metadata before attempting to print it.
  • Loading branch information
tboggs committed Jun 5, 2015
1 parent 898051c commit ca619c0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion spectral/graphics/spypylab.py
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,8 @@ def format_coord(self, x, y):
def __str__(self):
meta = self.data_rgb_meta
s = 'ImageView object:\n'
s += ' {0:<20}: {1}\n'.format("Display bands", meta['bands'])
if 'bands' in meta:
s += ' {0:<20}: {1}\n'.format("Display bands", meta['bands'])
if self.interpolation == None:
interp = "<default>"
else:
Expand Down

0 comments on commit ca619c0

Please sign in to comment.