shenxn / libdyson

Python library for dyson devices
Apache License 2.0
62 stars 41 forks source link

Error when running get_devices.py #34

Open tkm5 opened 1 year ago

tkm5 commented 1 year ago

Error when running get_devices.py What should I do?

Error log

$ python3 get_devices.py Please choose your account region 1: Mainland China 2: Rest of the World Region [1/2]: 2 Region code: JP Email: 005tbg@gmail.com Traceback (most recent call last): File "/home/takumig/libdyson/get_devices.py", line 22, in verify = account.login_email_otp(email, region) File "/home/takumig/libdyson/libdyson/cloud/account.py", line 122, in login_email_otp response = self.request( File "/home/takumig/libdyson/libdyson/cloud/account.py", line 114, in request raise DysonInvalidAuth libdyson.exceptions.DysonInvalidAuth

shadyabhi commented 1 year ago

+1. For me, the error is about the attr module.

shadyabhi@nuc10i7fnh:~/libdyson$ python3 get_devices.py
Traceback (most recent call last):
  File "get_devices.py", line 3, in <module>
    from libdyson.cloud import DysonAccount
  File "/home/shadyabhi/libdyson/libdyson/cloud/__init__.py", line 3, in <module>
    from .account import DysonAccount, DysonAccountCN  # noqa: F401
  File "/home/shadyabhi/libdyson/libdyson/cloud/account.py", line 19, in <module>
    from .device_info import DysonDeviceInfo
  File "/home/shadyabhi/libdyson/libdyson/cloud/device_info.py", line 5, in <module>
    import attr
ModuleNotFoundError: No module named 'attr'
shadyabhi@nuc10i7fnh:~/libdyson$ git show
commit 3137808d801c9192794b0ff9a0ea25cd5dbea8b8 (HEAD -> main, tag: v0.8.11, origin/main, origin/HEAD)
Author: Sami Taaissat <sam.taa@icloud.com>
Date:   Fri Apr 8 20:14:42 2022 +0200

    bump setup.cfg

diff --git a/setup.cfg b/setup.cfg
index 45b520b..2fdce11 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = libdyson
-version = 0.8.10
+version = 0.8.11
 author = Xiaonan Shen
 author_email = s@sxn.dev
 license = MIT License
shadyabhi@nuc10i7fnh:~/libdyson$
patate-pilees commented 1 year ago

@shenxn I get the same error as @tkm5, for the past few days that I tried this... basically the Dyson server is giving a HTTP response code 401 "Unauthorized"...

@shadyabhi have you imported the "attrs" module? If this is the problem, you will be able to get to the other error above [tkm5] I think!

shadyabhi commented 1 year ago

@shadyabhi have you imported the "attrs" module? If this is the problem, you will be able to get to the other error above [tkm5] I think!

get_devices.py is part of the official repo itself, so I would expect it to work as is! I personally didn't spend time debugging what has changed in recent months. As a consumer, I would expect the script to work as is, after the clone.

I'm pretty sure it used to work earlier because that's how I got the Dyson password the first time I set it up a few months ago.

patate-pilees commented 1 year ago

@shadyabhi have you imported the "attrs" module? If this is the problem, you will be able to get to the other error above [tkm5] I think!

get_devices.py is part of the official repo itself, so I would expect it to work as is! I personally didn't spend time debugging what has changed in recent months. As a consumer, I would expect the script to work as is, after the clone.

I'm pretty sure if used to work earlier because that's how I got the Dyson password the first time I set it up a few months ago.

Ok, I mentioned it because the error seemed related to the attrs module, and that it is specifically required in the "requirements.txt" file that we're instructed to import first.

mtjweb commented 1 year ago

Log out off the MyDyson app and try again, it solved the problem for me.

jorisc90 commented 1 year ago

Log out off the MyDyson app and try again, it solved the problem for me.

This solved the issue for me! Thanks mjtweb!