Hallöchen! Peter Hansen <[EMAIL PROTECTED]> writes:
> Torsten Bronger wrote: > >> keithley = GpibInstrument(14) >> keithley.write("*IDN?") >> print keithley.read() >> >> A keithley.close() would be a wart in my opinion; instead I want >> to hide the whole session thing from the programmer. Besides, I >> haven't yet given up the hope that the issues with __del__ can be >> tackled. > > At least one alternative comes to mind. Have the GpibInstrument > class (or its module) register an atexit() method, and have the > constructor for that class track all instances. On shutdown, the > atexit method goes through all instruments that are still open and > issues the .close() requests, or whatever you do in the __del__ > now. 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. Tschö, Torsten. -- Torsten Bronger, aquisgrana, europa vetus -- http://mail.python.org/mailman/listinfo/python-list