bme280: 'load_calibration_params' problem when running script
Traceback (most recent call last): File "sensor.py", line 8, in <module> calibration_params = bme280.load_calibration_params(bus, address) AttributeError: 'module' object has no attribute 'load_calibration_params'
This is the problem I get when running my script for my weather station. It is a python script but for the sake to get it uploaded with github’s limited file extensions I made it a text file
bme280_sensor.txt
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 27 (4 by maintainers)
Ok, my bad… test file was named “bme280.py” and this was a problem, just renaming file to “bme280test.py” fix this problem
Thank you very much Boris! Until today I had no time to test what you said. Now it works!
Funny I have the same issue. Although it’s not related to my naming of my python script as I’m using the ‘sample.py’ supplied.
If I attempt to run the ‘sample.py’ script from the directory /home/pi/bme280/examples it fails with the error :-
python sample.pyTraceback (most recent call last):File "sample.py", line 13, in <module>calibration_params = bme280.load_calibration_params(bus, address)AttributeError: 'module' object has no attribute 'load_calibration_params'however, if I copy the code to the directory /home/pi/bme280 it works fine :-
python sample.pycompensation_params = {'dig_H1': 75, 'dig_H3': 0, 'dig_H2': 386, 'dig_H5': 50, 'dig_H4': 264, 'dig_H6': '30, 'dig_P9': 4285, 'dig_P8': -10230, 'dig_T1': 28383, 'dig_T3': 50, 'dig_T2': 26590, 'dig_P1': 35048, 'dig_P3': 3024, 'dig_P2': -10521, 'dig_P5': 15, 'dig_P4': 6438, 'dig_P7': 9900, 'dig_P6': -7}uncompensated_reading(temp=0x0007F3A0, pressure=0x0005EBD0, humidity=0x00005F53, block=5E:BD:00:7F:3A:00:5F:53)compensated_reading(id=a7d93be9-635b-4f26-b4e3-5d733c21db29, timestamp=2019-12-22 15:21:27.399743UTC, temp=21.238 °C, pressure=987.47 hPa, humidity=43.98 % rH)Trying to run the code outside of the bme280 directory fails for me completely.
It seems to me that you need the a directory called ‘bme280’ in your current directory with the files “const.py const.pyc init.py init.pyc reader.py reader.pyc” in it.
I competely uninstalled and just installed it from pip. The it doesn’t work at all as no where do you have the files it seems to require. Seems something is missing during the install.