1

I am a beginner in python. Unfortunately, I just deleted the:

    ..Python3.5/http/ 

directory.

To fix that, I downloaded the same from https://github.com/python/cpython/tree/master/Lib/http

But when I run any script that needs the content of the deleted folder, I get this error

    File "/usr/lib/python3.5/http/client.py", line 1063
        chunk = f"{len(chunk):X}\r\n".encode('ascii') + chunk \
                            ^
    SyntaxError: invalid syntax

What is the syntax error and how can I fix this ?

Thanks in Advance

2
  • 3
    f-strings are new in Python 3.6. You try to run Python 3.6 code with Python 3.5. Commented Jun 9, 2018 at 18:22
  • Try github.com/python/cpython/tree/3.5/Lib/http, or just reinstall it properly Commented Jun 9, 2018 at 18:23

1 Answer 1

2

The line that is throwing the error is using the new 'f-string' syntax introduced in Python 3.6. You are trying to run it with Python 3.5 which does not support this feature.

To fix this you could either redownload the files from 3.5 branch or just reinstall Python using the installer.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.