Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

Troubles with USB connection


  • Please log in to reply
4 replies to this topic

#1 LaPlace

LaPlace
  • Members
  • 4 posts

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!

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

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.

#3 LaPlace

LaPlace
  • Members
  • 4 posts

Posted 14 November 2012 - 08:40 AM

Unfortunately the LabJackPython.Close() call just results in "NameError: name 'LabJackPython' is not defined"...

#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

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.


#5 LaPlace

LaPlace
  • Members
  • 4 posts

Posted 15 November 2012 - 05:30 AM

Works fine! Thank's a lot!


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users