Unbound names in __del__

Peter Hansen peter at engcorp.com
Sat Jun 18 21:16:36 CEST 2005


Torsten Bronger wrote:
>>Torsten Bronger wrote:
>>>    keithley = GpibInstrument(14)
>>>    keithley.write("*IDN?")
>>>    print keithley.read()
>>
[on using atexit]
> However, this doesn't close sessions while the program is running.
> If the programmer has the above code in a function which is called
> repeatedly, he may run into trouble.  IIRC my current VISA DLL has
> only 256 session slots.

Hmm... it sounds to me as though the design of this DLL is such that one 
is expected to hold a session open for the duration of the application. 
So instead of creating new GpibInstrument objects as needed, then just 
sort of dropping them, the programmers would have to create the required 
instrument objects at the start of the program and reuse them when needed.

But that's as far as my thoughts take me on this, without working 
directly with you.  I guess you'll have to explore the __del__ approach 
through to its conclusion before you'll be confident it won't work (or 
perhaps you'll find a solution after all!).

-Peter



More information about the Python-list mailing list