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

Installed requirements but immediate logging error on running server #18

Open
SnoopLawg opened this issue Jan 23, 2023 · 5 comments
Open

Comments

@SnoopLawg
Copy link

File "src/server.py", line 81
logging.error(f"webhook call received {webhook_topic}:\n{json.dumps(webhook_payload, indent=4)}")
^
SyntaxError: invalid syntax

@DSollick
Copy link

Hi @SnoopLawg, what version of Python are you running?

I'm betting it's complaining about the f-string, which was introduced in Python 3.6 https://realpython.com/python-f-strings/

@SnoopLawg
Copy link
Author

That solved that issue thank you, but a new one came up now.. /src/server.py", line 6, in <module> from flask import Flask, redirect, request, render_template File "/opt/homebrew/lib/python3.10/site-packages/flask/__init__.py", line 14, in <module> from jinja2 import escape ImportError: cannot import name 'escape' from 'jinja2' (/opt/homebrew/lib/python3.10/site-packages/jinja2/__init__.py)

@DSollick
Copy link

Unfortunately this is a case of dependency rot -- jinja2's latest version no longer includes the escape module which Flask 1 is relying on here. You could try changing the requirements.txt from Flask 1 to Flask 2 [I do not think there are any breaking changes that would affect this project but ymmv] and re-run pip. If that doesn't work, you could try pinning the jinja2 library < 3.1. Looks like werkzeug might also need to be <= 2.0.2

https://stackoverflow.com/questions/71718167/importerror-cannot-import-name-escape-from-jinja2
pallets/flask#4494

@DSollick
Copy link

I ran a quick test in a fresh docker container while setting flask=2.2.2 in requirements.txt and server.py started up with no issues. No guarantee that something else may have been changed/broken, but it's a start!

@SnoopLawg
Copy link
Author

Ok so what i found out for some reason when i updated to the newest version of python with homebrew and set that as my interpreter path in vscode, it did not like that and created errors in general not even just for this repository. Deleting and cleaning this new download through homebrew solved it when I just manually downloaded it from python's website. Thanks for all the help !

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

2 participants