avryhof / ambient_api

Python module for accessing the Ambient Weather API
MIT License
31 stars 18 forks source link

Should this work with Python 3.7 on Windows 10? #6

Closed dwadler closed 5 years ago

dwadler commented 5 years ago

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

dwadler commented 5 years ago

Never mind. I hacked around this.

arlenarlenarlen commented 5 years ago

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

dwadler commented 5 years ago

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.

avryhof commented 5 years ago

No hack needed.

Instead of

from ambient_api import AmbientAPI

use

from ambient_api.ambientapi import AmbientAPI

I'll add it to the README

dwadler commented 5 years ago

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