Skip to content

Commit

Permalink
Fixed call to library in list_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
hgrecco committed Apr 16, 2015
1 parent 3a713eb commit 8dd5611
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pyvisa/ctwrapper/highlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,22 +191,20 @@ def list_resources(self, session, query='?*::INSTR'):
:param query: regular expression used to match devices.
"""

lib = self.lib

resources = []

try:
find_list, return_counter, instrument_description, err = lib.find_resources(session, query)
find_list, return_counter, instrument_description, err = self.find_resources(session, query)
except errors.VisaIOError as e:
if e.error_code == constants.StatusCode.error_resource_not_found:
return tuple()
raise e

resources.append(instrument_description)
for i in range(return_counter - 1):
resources.append(lib.find_next(find_list)[0])
resources.append(self.find_next(find_list)[0])

lib.close(find_list)
self.close(find_list)

return tuple(resource for resource in resources)

0 comments on commit 8dd5611

Please sign in to comment.