webdjoe / pyvesync_v2

Python Library for controlling vesync API for all etekcity smart outlets, switches and bulbs and Levoit Air Purifier
MIT License
30 stars 17 forks source link

cannot import name 'VeSync' #7

Closed clharting closed 5 years ago

clharting commented 5 years ago

I installed the V2 version, but can't get it to work. I have tried it under python 2.7 and python3, and on at least two x86_64 PCs running Debian and Ubuntu.

charting@onyx2:~$ cat /etc/os-release NAME="Ubuntu" VERSION="18.04.3 LTS (Bionic Beaver)" ... charting@onyx2:~/hello$ pip3 install pyvesync_v2 Collecting pyvesync_v2 Downloading https://files.pythonhosted.org/packages/cb/85/bf79d5000d4a7e9c50fad71d598ec21d06f3623b30a2134542cd514ba8fa/pyvesync_v2-0.9.9-py2.py3-none-any.whl Collecting requests>=2.20.0 (from pyvesync_v2) Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl Collecting tzlocal (from pyvesync_v2) Downloading https://files.pythonhosted.org/packages/ef/99/53bd1ac9349262f59c1c421d8fcc2559ae8a5eeffed9202684756b648d33/tzlocal-2.0.0-py2.py3-none-any.whl Collecting pytz (from pyvesync_v2) Downloading https://files.pythonhosted.org/packages/87/76/46d697698a143e05f77bec5a526bf4e56a0be61d63425b68f4ba553b51f2/pytz-2019.2-py2.py3-none-any.whl (508kB) 100% |████████████████████████████████| 512kB 1.6MB/s Collecting certifi>=2017.4.17 (from requests>=2.20.0->pyvesync_v2) Using cached https://files.pythonhosted.org/packages/18/b0/8146a4f8dd402f60744fa380bc73ca47303cccf8b9190fd16a827281eac2/certifi-2019.9.11-py2.py3-none-any.whl Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests>=2.20.0->pyvesync_v2) Using cached https://files.pythonhosted.org/packages/81/b7/cef47224900ca67078ed6e2db51342796007433ad38329558f56a15255f5/urllib3-1.25.5-py2.py3-none-any.whl Collecting idna<2.9,>=2.5 (from requests>=2.20.0->pyvesync_v2) Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl Collecting chardet<3.1.0,>=3.0.2 (from requests>=2.20.0->pyvesync_v2) Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl Installing collected packages: certifi, urllib3, idna, chardet, requests, pytz, tzlocal, pyvesync-v2 Successfully installed certifi-2019.9.11 chardet-3.0.4 idna-2.8 pytz-2019.2 pyvesync-v2-0.9.9 requests-2.22.0 tzlocal-2.0.0 urllib3-1.25.5 charting@onyx2:~/hello$ /usr/bin/python3 /home/charting/hello/vesync_v2.py Traceback (most recent call last): File "/home/charting/hello/vesync_v2.py", line 1, in from pyvesync_v2 import VeSync ImportError: cannot import name 'VeSync' charting@onyx2:~$ python3 /home/charting/hello/vesync_v2.py Traceback (most recent call last): File "/home/charting/hello/vesync_v2.py", line 1, in from pyvesync_v2 import VeSync ImportError: cannot import name 'VeSync'

=================================== From the command line, I can't import VeSync, but I can import vesync (which doesn't work):

charting@onyx2:~$ python3 Python 3.6.8 (default, Aug 20 2019, 17:12:48) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.

from pyvesync_v2 import VeSync Traceback (most recent call last): File "", line 1, in ImportError: cannot import name 'VeSync' from pyvesync_v2 import vesync manager = vesync("test", "test", time_zone="America/New_York") Traceback (most recent call last): File "", line 1, in TypeError: 'module' object is not callable

clharting commented 5 years ago

Turns out the example is bad, I found some old scripts with: from pyvesync_v2.vesync import VeSync

webdjoe commented 5 years ago

I just uploaded the latest python package, it should match the readme now!