Unable to run dir(sht) to see available properties
micglin opened this issue · 2 comments
While poking at some new Stemma QT sensors I picked up, I was trying a command that worked for the SHT40 (product 4885), but it's failing for the SHTC3 (this product, 4636).
I'm using a QT PY, with CircuitPython version: adafruit-circuitpython-qtpy_m0_haxpress-en_US-6.2.0
I tested this also with a second QT PY, without a RAM chip added, and the normal CircuitPython, version: adafruit-circuitpython-qtpy_m0-en_US-6.2.0
To rule out that it wasn't a failure on my part, I downloaded the Project Bundle from the Learn page (build date 4/13/21), replaced my lib folder with the one contained, and replaced my code.py with the shtc3_simpletest.py file provided, named as code.py
Resetting the QT PY while monitoring serial, provides me the Temperature and Humidity readings I expect the code to provide.
However, I was still unable to use "dir(sht)" to see all available parameters. I can read the adafruit_shtc3.py source to see what they are, but I'm unable to use Python commands to see them, as it errors out.
Output working with SHT40:
>>> dir(sht)
['__class__', '__dict__', '__init__', '__module__', '__qualname__', 'i2c_device', 'mode', 'reset', 'temperature', 'serial_number', 'relative_humidity', 'measurements', '_crc8', '_buffer', '_mode']
Output for SHTC3:
>>> dir(sht)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "adafruit_shtc3.py", line 112, in _chip_id
File "adafruit_shtc3.py", line 112, in _chip_id
OSError: [Errno 5] Input/output error
@micglin .First thanks for this issue. A new change was just merged.
Could you test again with the merged changes, to see if you still have the issue.
thanks:
I've downloaded the updated adafruit_shtc3.py file, and tested as requested. The dir(sht) command now functions as I'd expect it to, thank you.
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit QT Py M0 with samd21e18
>>> import busio # IO module
>>> import board # default module
>>> import i2c_device # I2C module
>>> import adafruit_shtc3 # temp, humid I2C: 0x70
>>> i2c = busio.I2C(board.SCL, board.SDA)
>>> shtc3 = adafruit_shtc3.SHTC3(i2c)
>>> dir(shtc3)
['__init__', '__module__', '__qualname__', 'reset', 'temperature', 'i2c_device', '_buffer', 'low_power', 'sleeping', '_chip_id', '_get_chip_id', '_write_command', '_cached_sleep', '_low_power', 'relative_humidity', 'measurements', '_crc8']