question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GPIBInstrument.wait_for_srq() raises NotImplementedError

See original GitHub issue

pyvisa.resources.gpib.GPIBInstrument.wait_for_srq() calls enable_event(), wait_on_event(), and discard_events() of the underlying visalib. However, PyVisaLibrary does not implement those methods so NotImplementedError is raised.

One way to go about this is to delegate the missing methods to underlying pyvisa-py session objects and implement event support there.

Another possibility is to notice that wait_for_srq() is quite universal - in particular, VISA Service Request events should be supported by GPIB INSTR, GPIB INTFC, GPIB-VXI INSTR, TCPIP INSTR, USB INSTR, and VXI INSTR. So, wait_for_srq() could be moved to pyvisa.highlevel.VisaLibraryBase. This would make it easier to implement an overload in PyVisaLibrary before full-blown event support in pyvisa-py is ready.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
MatthieuDartiailhcommented, Dec 5, 2018

Could you open a [WIP] PR to make the changes easier to review and comment on ? I should be able to review it tonight.

0reactions
tivekcommented, Dec 4, 2018

@MatthieuDartiailh, I’m slowly hacking away on this. The GPIB-events branch is still not ready but event-related calls from PyVisaLib to Session objects have been wired through. Also, some preliminary support for GPIB events is in with some timeout-related bugs left to squash. Next is making events proper objects with .close(), .get_attribute() etc.

This seems to be a good time to ask for some feedback.

In particular, I wonder about storing event objects in its separate dict, PyVisaLibrary.events, as opposed to .sessions with which they share the pool of handles: https://github.com/tivek/pyvisa-py/blob/9f19bc992e89ae9c16f0a8af1090027cbb54edbd/pyvisa-py/highlevel.py#L103.

Also, I would like to hear your thoughts on ways to implement Attribute.in_resource() for event-related attributes. As it is now, attributes seem to expect sessions only.

Read more comments on GitHub >

github_iconTop Results From Across the Web

When to use 'raise NotImplementedError'? - Stack Overflow
Decorate with abstractmethod and let it raise NotImplementedError . This prohibits super().method() in implementations of method in derived ...
Read more >
raise NotImplemented should be raise NotImplementedError ...
Raise NotImplementedError to indicate that a super-class method is not implemented and that child classes should implement it. Anti-pattern. class BaseClass: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found