Pyserial again

Steve Holden steve at holdenweb.com
Tue Mar 7 10:20:58 EST 2006


Grant Edwards wrote:
> On 2006-03-07, luca72 <lucaberto at libero.it> wrote:
> 
> 
>>Here is my code; why after the readline the port close?
>>
>>        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
>>
>>        ser.readline()
>>        
>>    Why after this the port close.
> 
> 
> Because the "ser" object is never used after that point, so it
> get's garbage collected and deleted.
> 
????

The "ser" name is still bound to the serial object, surely?

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd                 www.holdenweb.com
Love me, love my blog         holdenweb.blogspot.com




More information about the Python-list mailing list