Python 3 : TypeError : 'str' does bit support the buffer interface : I'm developing a graphical interface with python 3, so i found a code that helps me to send a file(gcode) to GRBL , but this code is on python 2.
I tried to modify the programm to work on python 3
----------

    import serial
    import time
 
    # Open grbl serial port
    s = serial.Serial('/dev/ttyS0',115200)
 
    # Open g-code file
    f = open(r'/home/pi/Downloads/spinner.gcode');
 
    # Wake up grbl
    s.write("\r\n\r\n").encode("utf8")
    time.sleep(2)   # Wait for grbl to initialize
    s.flushInput()  # Flush startup text in serial input
 
    # Stream g-code to grbl
    for line in f:
        l = line.strip() # Strip all EOL characters for streaming
        print ('Sending: ' + l)
        s.write(l + '\n') # Send g-code block to grbl
        grbl_out = s.readline() # Wait for grbl response with carriage return
        print( ' : ' + grbl_out.strip())
 
    # Wait here until grbl is finished to close serial port and file.
    raw_input("  Press <Enter> to exit and disable grbl.")
 
    # Close file and serial port
    f.close()
    s.close()

When i run it ,it shows me an error :
TypeError : 'str' does not support the buffer interface 
