简体   繁体   中英

Python3.5/http/client.py SyntaxError: invalid syntax

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM