Pyserial again

Richie Hindle richie at entrian.com
Tue Mar 7 16:39:16 CET 2006


[luca]
> Here is my code; why after the readline the port close?
> 
>         ser = serial.Serial(0)
>         [...]
>         ser.readline()
>         
> Why after this the port close.

[Grant]
> Because the "ser" object is never used after that point, so it
> get's garbage collected and deleted.

[Steve]
> The "ser" name is still bound to the serial object, surely?

A piece of that code has been chopped off by someone's newsreader - it's the
body of a method, and ser.readline() is the last line of that method.

-- 
Richie Hindle
richie at entrian.com

-- 
Richie Hindle
richie at entrian.com



More information about the Python-list mailing list