Python UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb9 in position 0: invalid start byte

Asked 1 years ago, Updated 1 years ago, 89 views

Python python -m http.When I entered the command server, there was no error on other computers. But when I input it on my friend's computer, it says, "Traceback (most recent call last):" and at the end, UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb9 in position 0: invalid start byte It says so. First, I asked you to check the version. I'm asking you a question first just in case.

python unicodedecodeerror http

2022-09-22 11:52

1 Answers

The above error is the code that occurs when the following code is stored in a non-utf way, such as Ansi. If you select the following code as ANSI in the notepad and save it, the same error will occur.

#-*- coding: utf-8 -*-
print "Hangul"

But python -m http.server is the default module that you ran, and for UnicodeDecodeError to occur when you run this command, the server.py file in the Python installation folder\Lib\http must have that content. The same thing happens when I put that code in server.py.

Maybe http.You didn't touch the server, did you? Or I think it might be a problem that there is Korean in the path where Python is installed.


2022-09-22 11:52

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.