Cannot connect to T7 with python library | LabJack
 

Cannot connect to T7 with python library

5 posts / 0 new
Last post
HJM
hmcgui's picture
Cannot connect to T7 with python library

My T7 works find with Kipling and I've installed ljm for python. I can import ljm without error but when I attempt to get the handle of the T7 via

handle = ljm.openS("ANY", "ANY", "ANY")

 

I get the error

error = _staticLib.LJM_OpenS(deviceType.encode("ascii"), connectionType.encode("ascii"), identifier.encode("ascii"), ctypes.byref(cHandle))

AttributeError: 'NoneType' object has no attribute 'LJM_OpenS'

 

Any ideas on what is wrong?

LabJack Support
labjack support's picture
It sounds like the LJM

It sounds like the LJM library wasn't loaded, so the LJM_OpenS function could not be found.

What operating system are you using? Do you get an "Cannot load the LJM library" message when doing your import, "from labjack import ljm"? Is so, please provide the error details.

HJM
hmcgui's picture
 I can import ljm without

 I can import ljm without error. In fact, I can see the various methods/functions of the library such as ljm.LJMError, or ljm.addressToType, etc.

I've tried the T7 specific handle, getting the handle when Kipling is connected, when it is disconnected, and of course when Kipling is closed.

I'm using Windows 10.

LabJack Support
labjack support's picture
Reboot you computer and run

Reboot you computer and run something simple like:

from labjack import ljm
handle = ljm.openS("ANY", "ANY", "ANY")

If you are still getting the error, close out of the Python code or interpreter. Reinstall the LJM driver with the latest beta and install the latest LJM Python, and see if that helps:

https://labjack.com/support/software/installers/ljm
https://labjack.com/support/software/examples/ljm/python

With the latest LJM library and LJM Python modules, my quick tests with openS were working in both 32-bit and 64-bit versions of Python 2.7 and 3.6.

If you are running into further problems, what version of Python are you using? If it is not from python.org, what alternative implementation you are using?

Last, just for a quick extra testing, if you run this code and it returns None:

from labjack import ljm
print(ljm.ljm._staticLib)

That would indicate something went wrong with the LJM library load, and LJM library methods will fail. The above should normally display something similar to:

<WinDLL 'LabJackM.dll', handle 180000000 at 0x1ac1c8c6eb8>

HJM
hmcgui's picture
Thanks, the Restart fixed it.

Thanks, the Restart fixed it.