Re: Python bindings and a suggestion for improvement
dave penkler <[email protected]>
| Newsgroups | gmane.linux.hardware.gpib.general |
|---|---|
| Message-ID | <CAL=kjP1r6DZ4oGTM6p156xZFDhCgqHEUpj9Hb4G+x9VPkHD7qA@mail.gmail.com> |
Applied On Tue, Dec 4, 2018 at 8:05 PM Tomislav Ivek <[email protected]> wrote: > It turns out Python bindings do not expose the iblines() functionality. > This would be most useful for pyvisa-py to test if REN is asserted. > > I've been using the attached pach to call iblines() from Python. It adds > one new function, gpib.lines(), and line-related constants to the gpib > module. It also introduces the corresponding method Gpib.lines() to the > object-oriented Gpib module. > > Cheers, > Tomislav > > On Wed, Nov 28, 2018 at 3:49 PM Tomislav Ivek <[email protected]> > wrote: > >> Great, thank you! >> >> Tomislav >> >> >> On Wed, Nov 28, 2018, 15:37 dave penkler <[email protected] wrote: >> >>> Patch applied. Thanks. >>> >>> On Wed, Nov 28, 2018 at 1:52 PM Tomislav Ivek <[email protected]> >>> wrote: >>> >>>> Hi Frank, thanks for the reply. Attached is the patch that introduces a >>>> safe Gpib.Gpib.close() which will ensure proper cleanup. Please take a look. >>>> >>>> Cheers, >>>> Tomislav >>>> >>>> >>>> On Wed, Nov 28, 2018 at 11:15 AM Frank Mori Hess <[email protected]> >>>> wrote: >>>> >>>>> On Tue, Nov 27, 2018 at 4:19 PM Tomislav Ivek <[email protected]> >>>>> wrote: >>>>> > >>>>> > The pure-Python VISA backend pyvisa-py has recently stumbled upon a >>>>> double-close situation with linux-gpib's Python class Gpib.Gpib: >>>>> https://github.com/pyvisa/pyvisa-py/pull/171 This bug is related to a >>>>> design point in Gpib.Gpib which cleans up its GPIB handle only on Python's >>>>> GC cycle. This is not guaranteed to run when the programmer expects it to >>>>> and in extreme cases might even leak resources. It appears Gpib.Gpib has no >>>>> other user-facing method to close its GPIB handle. >>>>> > >>>>> > This can be resolved by adding a Gpib.close() method for >>>>> user-controlled cleanup. I hav ealready tested the fix in gpib_ctypes, a >>>>> cross-platform GPIB binding that aims to be compatible with linux-gpib ( >>>>> https://pypi.org/project/gpib-ctypes/). I would be happy to send a >>>>> patch for linux-gpib's Python lib. >>>>> > >>>>> > Please let me know what you think about that. >>>>> >>>>> >>>>> I'm no python expert, but your change sounds reasonable to me. >>>>> >>>> _______________________________________________ >>>> Linux-gpib-general mailing list >>>> [email protected] >>>> https://lists.sourceforge.net/lists/listinfo/linux-gpib-general >>>> >>> _______________________________________________ Linux-gpib-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-gpib-general