mdz / python-smarttub

Python API for SmartTub enabled hot tubs
MIT License
6 stars 9 forks source link

Error trying to use CLI #6

Closed Liam-Whiteside closed 3 years ago

Liam-Whiteside commented 3 years ago

Using Ubuntu 18.04.5 LTS sudo apt install python3-pip pip3 install python-smarttub

If I try and use the example CLI python3 -m smarttub -u first.lastname@gmail.com -p password info --status

I get Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/liam/.local/lib/python3.6/site-packages/smarttub/main.py", line 11, in st.login(*sys.argv[1:]) TypeError: login() takes 3 positional arguments but 7 were given

Also python3 -m smarttub --help Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/liam/.local/lib/python3.6/site-packages/smarttub/main.py", line 11, in st.login(*sys.argv[1:]) TypeError: login() missing 1 required positional argument: 'password'

mdz commented 3 years ago

Something is wrong with your installation. It looks like you have mismatched versions of api.py and main.py.

As you can see, that is not line 11:

https://www.github.com/mdz/python-smarttub/tree/main/smarttub%2F__main__.py

If this is the environment where you manually copied in api.py, you may want to start fresh and only install with pip.

python3 -m venv venv
. venv/bin/activate
pip install python-smarttub==0.0.19

On Thu, Mar 4, 2021, 11:04 Liam-Whiteside notifications@github.com wrote:

Using Ubuntu 18.04.5 LTS sudo apt install python3-pip pip3 install python-smarttub

If I try and use the example CLI python3 -m smarttub -u first.lastname@gmail.com -p password info --status

I get Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/liam/.local/lib/python3.6/site-packages/smarttub/main.py", line 11, in st.login(*sys.argv[1:]) TypeError: login() takes 3 positional arguments but 7 were given

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mdz/python-smarttub/issues/6, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADKVLYOUBIQ3TH26NTWR4LTB7KVHANCNFSM4YT2B3FQ .

Liam-Whiteside commented 3 years ago

That gets me as far as this $ pip install python-smarttub==0.0.19 Collecting python-smarttub==0.0.19 Could not find a version that satisfies the requirement python-smarttub==0.0.19 (from versions: 0.0.3) No matching distribution found for python-smarttub==0.0.19

mdz commented 3 years ago

Ah, I see the problem. I missed that you were running Ubuntu 18.04. Your Python version (3.6) is several years old now, and python-smarttub requires Python 3.7+. There was a very old and probably broken version (0.0.3) which did not specify which Python version it required, and that's the only version you see if you're on Python 3.6.

If you install Docker, you can do:

$ docker run -it python:3.9 bash
# pip3 install python-smarttub
# python3 -m smarttub ...

This will get you the latest version of the module.

Note that Home Assistant itself requires Python 3.8+, so if you're trying to run that in this same environment, you're likely to have a lot of problems, if it works at all.

On Fri, Mar 5, 2021 at 12:06 AM Liam-Whiteside notifications@github.com wrote:

That gets me as far as this $ pip install python-smarttub==0.0.19 Collecting python-smarttub==0.0.19 Could not find a version that satisfies the requirement python-smarttub==0.0.19 (from versions: 0.0.3) No matching distribution found for python-smarttub==0.0.19

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mdz/python-smarttub/issues/6#issuecomment-791239593, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADKVL6ASUFNKYKS2KC5TM3TCCGIPANCNFSM4YT2B3FQ .

mdz commented 3 years ago

I've removed python-smarttub 0.0.3 from PyPI to avoid this confusion.

Liam-Whiteside commented 3 years ago

I initially tried to run this on my MacBook under homebrew / python 3.9.1 but that gives cert errors below that I couldn't work out how to fix, hence trying on the Ubuntu box. Not sure if I'm ready to upgrade that yet and deal with what that breaks, so may try with a VM rather than docker next.

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)'))': /packages/07/c1/41ed787b74c7d77c02e6ec50755076091a8d795cdb50578c6edb2e2c52f1/python-smarttub-0.0.19.tar.gz ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/07/c1/41ed787b74c7d77c02e6ec50755076091a8d795cdb50578c6edb2e2c52f1/python-smarttub-0.0.19.tar.gz (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')))