question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python f-string E999-Syntar Error invalid syntax

See original GitHub issue

Hello, I have experienced this error message at this line: self.assertRedirects(response, f'/lists/{new_list.id}/') The ') signs are only underlined and flake says it is invalid syntax

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
HakunaMatata42commented, Jul 16, 2018

I had flake8 installed for both python2 and python3 and flake8 was being defaulted to python2, so I did the following to resolve the issue

pip uninstall flake8
pip3 install flake8
# This adds python3 flake8 installation to the PATH
export PATH=${PATH}:/Library/Frameworks/Python.framework/Versions/3.6/bin
flake8 --help
3reactions
matthew-nmcommented, Oct 1, 2018

The solution that worked for me is that from @Trivikram1. I essentially had to do

pip uninstall flake8
pip3 install flake8

even though my original flake8 installation was installed to my python3 virtual env using pip, it was the python2 version of flake8. You can tell the difference by looking at the CPython version number printed by the flake8 --version command. Before reinstalling, the CPython version printed was “2.7.15”, but after reinstalling with pip3, the CPython version was “3.6.5”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - f-strings giving SyntaxError? - Stack Overflow
In older python versions, an f-string will result in a syntax error. If you don't want to (or can't) upgrade, see How do...
Read more >
Python 3 SyntaxError: invalid syntax f strings - Softhints
I was working on a old python project and I got error: filename = f"{file}_{user.replace('/', '_')}.txt" ^ SyntaxError: invalid syntax.
Read more >
Issue 45086: f-string unmatched ']' - Python tracker
"SyntaxError: invalid syntax" is the default. It may have once been all that was ever reported. A lot of recent effort has gone...
Read more >
Invalid Syntax in Python: Common Reasons for SyntaxError
This means that the Python interpreter got to the end of a line (EOL) before an open string was closed. To fix this,...
Read more >
Error / Violation Codes — flake8 3.9.1 documentation
F541, f-string without any placeholders ... F722, syntax error in forward annotation. F723, syntax error in type ... We also report one extra...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found