Open GitQer opened 3 years ago
@GitQer, could give some more information? The exact code which caused the error and the full traceback. Otherwise it’s very difficult to help.
code: from keithley2600 import Keithley2600 k = Keithley2600('GPIB0::26::INSTR') k.apply_voltage(k.smua, 10) k.apply_voltage(k.smub, 8)
Traceback (most recent call last):
File "c:/Users/user/Desktop/kk.py", line 3, in
Ah, ok. So the issue is that you are not actually connected to the Keithley. The error message says:
ValueError: Please install linux-gpib (Linux) or gpib-ctypes (Windows, Linux) to use this resource type. Note that installing gpib-ctypes will give you access to a broader range of functionality.
Once you are connected, attributes like smua
, smub
, etc, will be available if your Keithley model supports them.
Since your connection is via GPIB, it looks like you will have to install gpib-ctypes
first. You can then connected manually with:
from keithley2600 import Keithley2600
k = Keithley2600('GPIB0::26::INSTR')
k.connect()
The last call will return True
if the connection is successful.
I connect to the keithley2634B and check it in NI-MAX, and I have installed the gpib-ctypes, but it seems not work.
from gpib_ctypes import make_default_gpib
make_default_gpib()
from keithley2600 import Keithley2600
k = Keithley2600('GPIB0::26::INSTR')
k.connect()
`D:\ANACONDA\envs\K2\lib\site-packages\gpib_ctypes\gpib\gpib.py:54: UserWarning: GPIB library not found. Please manually load it using _load_lib(filename). All GPIB functions will raise OSError until the library is manually loaded.
warnings.warn(message)
Traceback (most recent call last):
File "D:\ANACONDA\envs\K2\lib\site-packages\pyvisa_py\sessions.py", line 195, in get_session_class
return cls._session_classes[(interface_type, resource_class)]
KeyError: (<InterfaceType.gpib: 1>, 'INSTR')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:/Users/NAME/Desktop/kk.py", line 4, in <module>
k = Keithley2600('GPIB0::26::INSTR')
File "D:\ANACONDA\envs\K2\lib\site-packages\keithley2600\keithley_driver.py", line 1679, in __new__
instance = Keithley2600(*args, **kwargs)
File "D:\ANACONDA\envs\K2\lib\site-packages\keithley2600\keithley_driver.py", line 841, in __init__
Keithley2600Base.__init__(
File "D:\ANACONDA\envs\K2\lib\site-packages\keithley2600\keithley_driver.py", line 566, in __init__
self.connect(**kwargs)
File "D:\ANACONDA\envs\K2\lib\site-packages\keithley2600\keithley_driver.py", line 584, in connect
self.connection = self.rm.open_resource(self.visa_address, **kwargs)
File "D:\ANACONDA\envs\K2\lib\site-packages\pyvisa\highlevel.py", line 3304, in open_resource
res.open(access_mode, open_timeout)
File "D:\ANACONDA\envs\K2\lib\site-packages\pyvisa\resources\resource.py", line 297, in open
self.session, status = self._resource_manager.open_bare_resource(
File "D:\ANACONDA\envs\K2\lib\site-packages\pyvisa\highlevel.py", line 3232, in open_bare_resource
return self.visalib.open(self.session, resource_name, access_mode, open_timeout)
File "D:\ANACONDA\envs\K2\lib\site-packages\pyvisa_py\highlevel.py", line 163, in open
cls = sessions.Session.get_session_class(
File "D:\ANACONDA\envs\K2\lib\site-packages\pyvisa_py\sessions.py", line 197, in get_session_class
raise ValueError(
ValueError: No class registered for InterfaceType.gpib, INSTR`
It appears that gpib-ctypes
cannot find the GPIB library that should come installed with NI-VISA and asks you to manually specify the location. I am neither familiar with Windows nor with GPIB (we use Linux and Ethernet connections in our lab) so cannot help there.
Alternatively, you could try to completely switch backends and use the NI-VISA backend directly, as described in the README.
As suggested by Sam in an earlier query, the following works in my windows7 install...
k = Keithley2600('GPIB0::26::INSTR', visa_library='C:\windows\system32\visa64.dll') k.reset()
but, k.reset (same as *RST) may not be able to correctly reset the instrument to default state under certain conditions (e.g., when comms have been interrupted, such after a program sweep that failed), thus appearing as if the instrument commands are not available. In this case, functionality can be easily restored with a reset via the NI VISA Test panel (ensuring that the STB? query returns status byte 0)...
Hello, I try to use this package but an error happened that Instance of 'Keithley2600Factory' has no 'smua' member