Thanks, I did initially follow those instructions, this is the error I received running
python3 -c "import bme280":
pi@raspberrypi:~ $ python3 -c "import bme280"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/pi/bme280.py", line 162
print "Chip ID :", chip_id
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Chip ID :", chip_id)?
def main():
(chip_id, chip_version) = readBME280ID()
print "Chip ID :", chip_id
print "Version :", chip_version
temperature,pressure,humidity = readBME280All()
print "Temperature : ", temperature, "C"
print "Pressure : ", pressure, "hPa"
print "Humidity : ", humidity, "%"
Added the missing parentheses, tried running it again but still received a bunch of different errors, so I decided to uninstall all instances of bme280 and RPi.bme280 (python 2 and 3) and start over using pip3 install.
I can now run bme280 sample script directly from within its own directory under python3 :
pi@raspberrypi:~/.local/lib/python3.7/site-packages/bme280 $ python sample.py
33fd4292-66f4-4994-8b69-523d13a7c3a7
2021-07-18 17:12:20.905437
21.5680572186
1013.10937762
58.1974230463
compensated_reading(id=33fd4292-66f4-4994-8b69-523d13a7c3a7, timestamp=2021-07-18 17:12:20.905437, temp=21.568 °C, pressure=1013.11 hPa, humidity=58.20 % rH)
but it fails if I try to run it from anywhere else, and if I try running weewxd, I get:
Traceback (most recent call last):
File "/usr/share/weewx/weewxd", line 264, in <module>
main()
File "/usr/share/weewx/weewxd", line 151, in main
engine = weewx.engine.StdEngine(config_dict)
File "/usr/share/weewx/weewx/engine.py", line 93, in __init__
self.loadServices(config_dict)
File "/usr/share/weewx/weewx/engine.py", line 161, in loadServices
obj = weeutil.weeutil.get_object(svc)(self, config_dict)
File "/usr/share/weewx/weeutil/weeutil.py", line 1119, in get_object
mod = __import__(module)
or trying to run the example 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'
Under python3 I'm seeing:
pi@raspberrypi:~/.local/lib/python3.7/site-packages/bme280 $ ls
const.py __init__.py __pycache__ reader.py sample.py
but under python2 I'm getting (no sample.py installed with this package)
pi@raspberrypi:~/.local/lib/python2.7/site-packages/bme280 $ ls
const.py const.pyc __init__.py __init__.pyc reader.py reader.pyc
I have no problem starting everything over from scratch, but not sure if I'm missing something obvious with bme280 install? weewx, rtl-sdr, Belchertown, i2c, etc all went quite smoothly, but bme280 isn't being as nice.
Cheers