Pyserial again

luca72 lucaberto at libero.it
Tue Mar 7 11:26:51 EST 2006


Ok you write that it close :Because the "ser" object is never used
after that point, so it
get's garbage collected and deleted.

But for example if i make one button with the same caracteristic of the
previous com port:

def OnButton1Button(self, event):

           ser = serial.Serial(0)

>         ser.baudrate = 9600
>         ser.parity = serial.PARITY_ODD
>         ser.stopbits = serial.STOPBITS_TWO
>         ser.bytesize =serial.EIGHTBITS
>         ser.setRTS(level = 0)
>         ser.setDTR(level = 0)
>         ser.timeout = 1
  But with
          a = textCtrl1GetValue()  # i put here some different string
to send
          ser.write (a)
          b = ser.readline()
          textCtrl2SetValue(b)

why at any read the serial close, is possible to prevent the closure of
the port?




More information about the Python-list mailing list