rene-d / netatmo

Python3 API for the Netatmo Weather Station
The Unlicense
36 stars 18 forks source link

Error on import Netatmo #6

Closed patalex74 closed 4 years ago

patalex74 commented 4 years ago

Hi, Congrats for your job, one issue when I want to try it :

Traceback (most recent call last): File "/Users/patrick/Documents/hh.py", line 3, in import netatmo File "/Users/patrick/Documents/netatmo.py", line 5, in netatmo.fetch() AttributeError: partially initialized module 'netatmo' has no attribute 'fetch' (most likely due to a circular import)

Any idea on what is wrong ? Thanks

rene-d commented 4 years ago

Hi,

I guess you have downloaded netatmo.py. It's better to install it with pip

However, I cannot reproduce this error :

~/tmp: curl -s -O https://raw.githubusercontent.com/rene-d/netatmo/master/src/netatmo/netatmo.py
~/tmp: cat hh.py
import netatmo
netatmo.fetch()
~/tmp: python3 hh.py
station_name : <my station name>
device_id    : 70:ee:50:xx:yy:zz
module_name  : Salon
data_type    : ['Temperature', 'CO2', 'Humidity', 'Noise', 'Pressure']
module_id    : 02:00:00:xx:yy:zz
module_name  : Terrasse
...

Tested on Linux and macOS.

I remind you that this module requires Python 3.5+ and won't work with 2.x

patalex74 commented 4 years ago

Thanks for reply I installed Netatmo with pip here's my python 3.8 script :

! /usr/bin/env python3

import netatmo

fetch data using ~/.netatmorc credentials

netatmo.fetch()

credentials as parameters

ws = netatmo.WeatherStation( { 'client_id': '5e33ea0b5xxxxxxx......', 'client_secret': 'xxxxx....xxxxxxx', 'username': 'xxx@gmail.com', 'password': 'xxx...xxxxxx', 'default_station': '70:ee:50:........' } ) ws.get_data() print(ws.devices)

And I've got same error message ! What did I do wrong ? (I'm on macOS 10.15) thanks

rene-d commented 4 years ago

You have a file named netatmo.py in your working directory (File "/Users/patrick/Documents/netatmo.py").

If it's not the module, you have to rename it ;-)

patalex74 commented 4 years ago

Great !! You can close this issue, all is Ok now, Thanks again.

Question : Do you have any plan to develop other modules (rain, wind ? )

rene-d commented 4 years ago

I don't have these modules. However, they can easily be added.