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





On Saturday, 17 July 2021 at 21:17:45 UTC-4 vince wrote:

> On Saturday, July 17, 2021 at 1:38:02 PM UTC-7 Elie R wrote:
>
>>   File "/usr/share/weewx/user/bme280wx.py", line 6, in <module>
>>     import bme280
>> ModuleNotFoundError: No module named 'bme280'
>>
>>
> This one seems like you didn't install the bme280 module for the version 
> of python (2 or 3) that weewx is using.  A quick search points to 
> https://pypi.org/project/RPi.bme280/  for installation instructions.
>
> You might try a couple simple tests.
>
>    - python -c "import bme280"
>    - python3 -c "import bme280"
>
> You should get an error if that version of python does not have the module 
> installed.
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/e1f0a4e2-a4f2-4b05-8420-27c392942fd8n%40googlegroups.com.

Reply via email to