Skip to content

Commit

Permalink
Merge pull request #900 from dkriegner/master
Browse files Browse the repository at this point in the history
VisaAdapter: close manager only when using pyvisa-sim
  • Loading branch information
bilderbuchi committed Jun 19, 2023
2 parents 3c288c7 + 657a666 commit 3e16918
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pymeasure/adapters/visa.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,13 @@ def close(self):
"""
super().close()
try:
self.manager.close()
if self.manager.visalib.library_path == "unset":
# if using the pyvisa-sim library the manager has to be also closed.
# this works around https://github.com/pyvisa/pyvisa-sim/issues/82
self.manager.close()
except AttributeError:
pass # Closed from another adapter using the same connection.
# AttributeError can occur during __del__ calling close
pass

def _write(self, command, **kwargs):
"""Write a string command to the instrument appending `write_termination`.
Expand Down

0 comments on commit 3e16918

Please sign in to comment.