Python 2 - 3 Porting Issues
<p><strong>Background</strong></p>

<p>I am trying to learn Python 3. To jumpstart, I am porting a simple Python 2 script of mine to Python 3. The script is a <em>extremely</em> simple and I am stuck on a few issues. </p>

<p><strong>The Issues</strong></p>

<ol>
<li><code>TypeError: 'str' does not support the buffer interface</code></li>
</ol>

<p>I use the socket <code>.send()</code> command to send the server's welcome message. When the server attempts to send it, I get the above error. Here is the relevant code.</p>

<pre><code>def clientthread(connection):

    #Sending message to connected client
    #This only takes strings (words

    connection.send("Welcome to the server. Type something and hit enter\n")

    #loop so that function does not terminate and the thread does not end
    while True:

        #Receiving from client
        data = connection.recv(1024)
        if not data:
            break
        connection.sendall(data)
        print (data)
    connection.close()
</code></pre>

<p>And here is the traceback:</p>

<pre><code>Unhandled exception in thread started by &lt;function clientthread at 0x1028abd40&gt;
Traceback (most recent call last):
  File "/Users/*****/Desktop/Coding/Python 3/Sockets/IM Project/Server/Server v3.py", line 41, in clientthread
    connection.send("Welcome to the server. Type something and hit enter\n")
TypeError: 'str' does not support the buffer interface
</code></pre>

<p><strong>NOTES:</strong></p>

<p>I am porting from Python 2.7.3 to Python 3.3</p>

<p>I will add more errors as they arise.</p>

<hr>

<p><strong>EDIT</strong></p>

<p>Even though [this] was a great answer, there appears to be an issue - all messages sent to the server are preceded with a <code>b</code>. My client is in Python 2 (I will port it later tonight) - could this be part of the issue? In any case, here is the relevant code.</p>

<p><strong>Client Main Loop</strong></p>

<pre><code>while True:   
    #Send some data to the remote server
    message = raw_input("&gt;&gt;&gt;  ")

    try:
         #set the whole string
         s.sendall(USER + " :  " + message)
    except socket.error:
    #Send Failed
        print "Send failed"
        sys.exit()

    reply = s.recv(1024)
    print reply
</code></pre>

<p><strong>Shell Stuff Server</strong></p>

<pre><code>HOST: not_real.local
PORT: 2468
Socket Created
Socket Bind Complete
Socket now listening
Connected with 25.**.**.***:64203
b'xxmbabanexx :  Hello'
</code></pre>
