JurajNyiri / pytapo

Python library for communication with Tapo Cameras
MIT License
277 stars 58 forks source link

SyntaxError while testing the __init__.py script #89

Closed Pytoune closed 9 months ago

Pytoune commented 9 months ago

Hi, I tried to test a simple script with pytapo 3.3.18

#!/usr/bin/env python3
from pytapo import Tapo
tapo = Tapo("192.168.1.20", "admin", "cloud_password")
request = tapo.getBasicInfo()
print(request)

But I have the next traces :

File "test.PY", line 3, in <module>
    from pytapo import Tapo
  File "/usr/local/lib/python3.7/dist-packages/pytapo/__init__.py", line 16, in <module>
    from .media_stream.session import HttpMediaSession
  File "/usr/local/lib/python3.7/dist-packages/pytapo/media_stream/session.py", line 14, in <module>
    from pytapo.media_stream._utils import (
  File "/usr/local/lib/python3.7/dist-packages/pytapo/media_stream/_utils.py", line 56
    if i := b.find(sep, start_index) != -1:
          ^
SyntaxError: invalid syntax

Can you help me ?

JurajNyiri commented 9 months ago

Use uptodate python, 3.7 is very old.

Pytoune commented 9 months ago

Thank you JurajNyiri, it is solved by using last Pytapo version (3.3.18) with recent Python version (3.9). Thank you for your project which help a lot of people.

slavino commented 9 months ago

I'm not python dev.

Had to get newer Python sources for 3.12 and compile it on Raspbian with all the DEV dependencies for Python compilation [src: https://orcacore.com/install-python312-ubuntu-debian/].

sudo apt install -y libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev wget build-essential libreadline-dev

Could you please list these reqs along with ffmpeg lib to main README as download yells for it's absence with ffprobe missing notes?