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

U3 cannot be transferred between Python instances


  • Please log in to reply
3 replies to this topic

#1 eswint

eswint
  • Members
  • 2 posts

Posted 05 May 2014 - 02:36 PM

It appears that U3 (and possibly all LabJack devices) aren't closed or deleted properly in Python, so that one Python instance can't relinquish control of the device to another Python instance.

 

For example, if I've got 2 U3s plugged into my computer:

* testDualLabJack script will print the local IDs of both devices.

* testDualLabJack2, which opens, closes, deletes a U3 instance, and waits for a user terminate signal.

 

If testDualLabJack2 has not exited, the first script will only open 1 device.

 

I'd like to be able to hand control of a labjack between two Python instances, as it makes debugging and trouble-shooting easier.

Attached Files



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 05 May 2014 - 10:19 PM

The close method in the U3 class only works on Linux and Mac OS X. On Windows the close method does nothing since there is no close call for individual devices in the UD driver. The only close call in the UD driver is the "Close" function which closes all devices opened by the process (Python instance). In Python, the Close function is in the LabJackPython module and used like this:

import LabJackPython
import u3

#U3 opens and calls

#Close all opened device handles in this process (Windows UD driver only).   
LabJackPython.Close()


#3 eswint

eswint
  • Members
  • 2 posts

Posted 15 May 2014 - 04:20 PM

OK, thanks. It would be nice if the method threw a NotImplemented exception on Windows. I'll just remember what labjacks are open before I call the global close and reopen them.



#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 15 May 2014 - 04:44 PM

Thanks for the not implemented exception suggestion. I'll look into if that is an exception we'll want to have or at least a terminal message for backwards compatibility reasons.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users