Sublime runs Python directly to prompt decode error


Use Ctrl + B in sublime text to run Python directly. Sometimes, a strange error will be output due to coding problems (I’m sure it’s OK on the console. Why do I get this error as soon as I get to sublime text)

Decode error - output not utf-8

The solution is to modifyPython.sublime-buildconfiguration file
Generally, this file is located inC:\Users\[Users]\AppData\Roaming\[Sublime Text Version]\Packages\Python
The easy way is to clickPreferences -> Browse packagesThen open the resource manager to find the python folder, which contains the file. Open the file, and add a code description in the last line. After modification, it is as follows

    "cmd": ["python", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",
    "encoding": "cp936"

Recommended Today

Blog based on beego, go blog

Go Blog A beego based development, can quickly create personal blog, CMS system Include functions see Official website of go Demo Update log time function January 23, 2020 New top post function February 2, 2020 New custom navigation function February 4, 2020 New site announcement function February 6, 2020 New link module February […]