Python socket programming error

hello.
I recently started to learn python and I keep having the same problem in the socket programming section.
I run the same codes in a youtube video that I on my spyder. I followed exact intructions but I cant continue because kernel keep giving me red error.
here are codes


#server.py

import socket
import threading

PORT = 5050
SERVER = socket.gethostbyname(socket.gethostname())
ADDR = (SERVER,PORT) 
HEADER = 64
FORMAT = "utf-8" 
DISCONNECT_MESSAGE ="DISCONNECT!"

server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(ADDR)


def handle_client(conn,addr):
    print(f"NEW CONNECTİON {addr} connected")
    
    connected = True
    while connected:
        msg.length = conn.recv(HEADER).decode(FORMAT)
        msg.length = int(msg.length)
        msg = conn.recv(msg.length).decode(FORMAT)
        if msg == DISCONNECT_MESSAGE:
            connected = False
            
    print(f"[{addr}] {msg}")  

#conn.close()

def start():
    server.listen()
    print(f"[LISTENING] server is listening on {SERVER}")
    conn, addr = server.accept()
    thread= threading.Thread(target=handle_client, args=(conn, addr))
    thread.start()
    print(f"[ACTİVE CONNECTİONS] {threading.activeCount()-1}")

the output

(You don’t need to blur out an IP address that starts 192.168 - it’s a private address that only means anything within your local network. For example, I’m currently on a computer with addresses 192.168.0.19 and 192.168.2.2 - but there can be myriad other computers in the world with either or both of those addresses.)

This doesn’t show any errors. What is the problem here? Possibly there’s additional red text that didn’t make it into the screenshot?

It may not be the problem you identified, but there is a (or at least “a”) problem in this code.

Please see:
https://stromberg.dnsalias.org/~strombrg/TCP/
https://stromberg.dnsalias.org/~strombrg/bufsock.html