Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax Error #5

Closed
Mod74 opened this issue Feb 1, 2020 · 3 comments
Closed

Syntax Error #5

Mod74 opened this issue Feb 1, 2020 · 3 comments

Comments

@Mod74
Copy link

Mod74 commented Feb 1, 2020

Hi, I think I have this working from a Home Assistant / Python point of view, however when I run I get a Python Syntax error

Syntax errors detected :

Line 26:
data[f'{binType}'] = f'{binCollection}'
^
SyntaxError: invalid syntax

I know next to nothing about coding so I tried checking here https://extendsclass.com/python-tester.html and it shows the same error. I checked the other bin collection scripts and the one that is similar to this throws the same error, but the ones that are completely different doesn't. I checked pythonbuddy.com and it said "Format strings are only supported in Python 3.6 and greater (, line 26)" however I have 3.7 installed as Home Assistant required it and the venv was set up using it. I tried to shebang the specific version 3.7.3 and it still threw the syntax error. Any idea?

Originally posted by @Mod74 in #3 (comment)

@robbrad
Copy link
Owner

robbrad commented Feb 7, 2020

Hi @Mod74

I have removed the f strings from the commit c4facec

Can you try again?

My worry is the next error you will be ImportError: No module named 'bs4'

How are you running this? and can you try the following as a script.

import sys
print(sys.version)

@Mod74
Copy link
Author

Mod74 commented Feb 9, 2020

Hi,

Thank you again for looking at this. When I try the new code I get

Traceback (most recent call last):
  File "durhamccbins.py", line 2, in <module>
    from urllib.request import Request, urlopen
ImportError: No module named request

I manually added beautiful soup so I guess it's found it, or maybe not.

I tried installing urllib and it said it was already installed.

When I run the version command script I get

2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0]

I was hoping to run this using the HA Python method, as that seemed easier as I'm on a Pi venv, but the tests above are done by SSH into the Pi and then running pyton filename.py from the command line. However I'm far far from an expert on these things so I dunno, it could be running beautifully in the original version of the code but I'm just doing something else wrong.

@dp247
Copy link
Collaborator

dp247 commented Nov 8, 2022

Project has been rewritten since this, so going to preliminary close. Feel free to reopen if its still an issue though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants