Hi,

TypeError: a bytes-like object is required, not 'str'
...
mysock.send('GET http://data.pr4e.org/intro-short.txt HTTP/1.0\n\n')

Here you must encode the str as bytes:

mysock.send('GET http://data.pr4e.org/intro-short.txt HTTP/1.0\n\n'.encode("UTF-8"))

The actual encoding does not matter in your case since you only have ASCII.

    data =x.recv(512)

This gives the next error:

    NameError: name 'x' is not defined

What is x supposed to be?

Regards

Lutz


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to