Error on PySerial on Python 3.3
<p>I found a code on the internet to paython communicate with the arduino, but don't work. The code is for paython 2, but i make some change and don't work again. The code for the paython is:</p>

<p>Autor: Fernando Krein Pinheiro
 Data: 07/09/2011
 Linguagem: Python</p>

<p>========= IMPORTANTE ===========
 O codigo esta livre para usar,
 citar e compartilhar desde que
 mantida sua fonte e seu autor.
 Obrigado.</p>

<p>`import serial
porta = "COM5"
baud_rate = 9600</p>

<p>def escrever_porta():</p>

<pre><code>try:
    valor = (input("Digite 1 para ligar o led.\nDigite 2 para desligar o led.\n"))
    Obj_porta = serial.Serial(porta, baud_rate)
    Obj_porta.write(bytes(valor))
    ler_porta()
    Obj_porta.close()

except serial.SerialException:
    print("ERRO: Verifique se ha algum dispositivo conectado na porta!")
</code></pre>

<p>def ler_porta():</p>

<pre><code>try:
    Obj_porta = serial.Serial(porta, baud_rate)
    valor = Obj_porta.readline()
    print("Arduino disse: "),valor
    Obj_porta.close()

except serial.SerialException:
    print("ERRO: Verifique se ha algum dispositivo conectado na porta!")
</code></pre>

<p>if <strong>name</strong>=='<strong>main</strong>':</p>

<pre><code>    escrever_porta()
</code></pre>

<p>`</p>

<h1>and the error that appears is:</h1>

<p>Traceback (most recent call last):
  File "C:\Users\Bruno\workspace\Automacao\src\ComunicacaoArduino.py", line 43, in 
    escrever_porta()
  File "C:\Users\Bruno\workspace\Automacao\src\ComunicacaoArduino.py", line 21, in escrever_porta
    Obj_porta.write(bytes(valor))
TypeError: string argument without an encoding</p>

<p>Who can help me?</p>
