labjack / LabJackPython

The official Python modules and classes for interacting with the LabJack U3, U6, UE9 and U12
https://labjack.com/support/software/examples/ud/labjackpython
MIT License
117 stars 79 forks source link

Fix TypeError when handle is None on Python 3 #105

Closed mnaberez closed 6 years ago

mnaberez commented 6 years ago

Fixes #103. Adds an explicit check for None on the handle returned by openDev().

Python 3 changed the behavior of comparing None to int as shown below.

$ python2
>>> None <= 0
True

$ python3
>>> None <= 0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: '<=' not supported between instances of 'NoneType' and 'int'
davelopez01 commented 6 years ago

Thanks for fixing this.