Skip to content

Commit

Permalink
make print_readable_snapshot work with value-less parameters (#844)
Browse files Browse the repository at this point in the history
* make print_readable_snapshot work with value-less parameters

* Update docstring, don't use try-except
  • Loading branch information
WilliamHPNielsen authored Nov 2, 2017
1 parent 956ffe4 commit 67826b5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion qcodes/instrument/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,12 @@ def print_readable_snapshot(self, update=False, max_chars=80):
for par in sorted(snapshot['parameters']):
name = snapshot['parameters'][par]['name']
msg = '{0:<{1}}:'.format(name, par_field_len)
val = snapshot['parameters'][par]['value']

# in case of e.g. ArrayParameters, that usually have
# snapshot_value == False, the parameter may not have
# a value in the snapshot
val = snapshot['parameters'][par].get('value', 'Not available')

unit = snapshot['parameters'][par].get('unit', None)
if unit is None:
# this may be a multi parameter
Expand Down

0 comments on commit 67826b5

Please sign in to comment.