Pyserial,Docs, tutorials, line terminators

Chris Liechti cliechti at
Wed Mar 19 01:15:45 CET 2003

vector <Vector180W at> wrote in 
news:3E76867F.3080002 at
> Im using the windows environment. and as such once the serial port is 
> open the readline() is missing the /r (terminating on /n) causign all 
> sorts of greif. 

its not missing it, it behaves similar to readline on files with returns a 
'\n' terminated line, it just does not do any EOL conversion.

do you know 'somestr'.replace('\r', '') or better 's'.strip() or rstrip()?
these help usualy as they easily remove the unwanted character.

an other problem is, what behaviour should readline have? there are all 
sorts of problems like what to do with timeouts, what if the port was 
opened nonblocking, EOL characters etc... a good practice is to write your 
own function that does what you exepct ;-)


Chris <cliechti at>

More information about the Python-list mailing list