avryhof/ambient_api

Should this work with Python 3.7 on Windows 10?

dwadler opened this issue · 5 comments

I just installed this with pip but it fails trying to import AmbientAPI.

This is the complete code:
`from ambient_api import AmbientAPI

api = AmbientAPI()

devices = api.get_devices()
print (devices)
device = devices[0]

print(device.get_data())`

This is the result:
E:\dwacode\smarthome\ambientweather>python test1.py
Traceback (most recent call last):
File "test1.py", line 2, in
from ambient_api import AmbientAPI
ImportError: cannot import name 'AmbientAPI' from 'ambient_api' (d:\python37\lib\site-packages\ambient_api_init_.py)

E:\dwacode\smarthome\ambientweather>pip list
Package Version


ambient-api 1.5.2

Never mind. I hacked around this.

@dwadler what was your hack? I'm having the same issue on Ubuntu.

I copied ambientapi.py to the directory with my source.. It would be nice to know how to fix the problem so that it works as expected.

No hack needed.

Instead of

from ambient_api import AmbientAPI

use

from ambient_api.ambientapi import AmbientAPI

I'll add it to the README

Thank you. Python 'from' and 'import' are still a mystery to me.