Troubles with USB connection
4 replies to this topic
Posted 13 November 2012 - 10:16 AM
Hi, I'm working with a UE9 in our lab. It's connected via USB to our computer (Windows XP). I'm trying to control the LabJack with Python. Unfortunately, I'm only able to run my script once because I then get the error message: "LabJack is already open via USB in another program or process". I have to restart my computer to be able to run it again. Any ideas how to get rid of the error? Thanks a lot!
Posted 13 November 2012 - 01:44 PM
Did your previous script stop running? A LabJack device can only be accessed by one process at a time. Make sure your previous script has stopped running before running another one. Also, on Windows you can close your device with the LabJackPython.Close() call. Note that this closes all devices that were opened in the current process, and UE9.close() does not do anything on Windows.
Posted 14 November 2012 - 08:40 AM
Unfortunately the LabJackPython.Close() call just results in "NameError: name 'LabJackPython' is not defined"...
Posted 14 November 2012 - 11:15 AM
In your Python script you will need need to import the LabJackPython module first. So:
import ue9 import LabJackPython d = ue9.UE9() # Opens first found UE9 # Doing UE9 stuff LabJackPython.Close() # Closes all handles in the current process. The UE9 handle in the d object is no longer valid.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users