bachya/simplisafe-python

syntax error when I : import simplipy

Closed this issue · 10 comments

here is a partial snippet . Notice I had to add commas .
I get a error : Exception has occurred: SyntaxError invalid syntax.

simplisafe-python
async def main() -> None:

async with ClientSession() as session:
    api = await simplipy.API.async_from_credentials(
        "secret1",
         "secret2",
        session=session,
    )

asyncio.run(main())

Please post the entire script and make sure you format it properly; I can't currently tell what is code and what isn't.

import asyncio #<--dies here

from aiohttp import ClientSession
import simplipy


async def main() -> None:
    """Create the aiohttp session and run."""



    async with ClientSession() as session:
        api = await simplipy.API.async_from_credentials(
            "emailpwd",
             "pwd",
            session=session,
        )


asyncio.run(main())

If the script dies at import asyncio, the issue is with your environment (and not this library).

Correction. I meant to say it dies on line 4
import simplipy
is there a way to trouble shoot the version of the module?

here is a screen shot

https://imgur.com/cv6vhmd

Line 41 of simplipy/api.py doesn't have a syntax error. The example scripts included in this repo all work fine.

  • What OS are you on?
  • How did you install simplipy?
  • What version of Python are you using?

I am using windows 11
python version 3.10.4
pip install simplisafe-python --- yesterday .

I took a closer look at your screenshot:

image

The error doesn't reference simplipy/api.py – it references simplipy.py, which isn't a file in this library. You likely created that file in the same directory (or somewhere else in your Python path) and simpli1.py is trying to import that file, not this library.

Yes, I had a file called simplipy.py - Sorry for wasting your time !
I've been programmer since 1980 non-stop , and I still make silly mistakes.

No worries! I do, too, and helping each other is what's great about open-source. 👍🏻