Pyserial,Docs, tutorials, line terminators

vector Vector180W at netscape.net
Wed Mar 19 00:25:07 EST 2003


thanks Chris i have managed to get it kinda working. I was after a more 
broad spread doc or tut on how the whole pyserial thing works. I have 
many ifs n maybes about it. for eg if I have an error in my script and 
its after the open serial port. when i next run it the port cant be 
opened. id prefer to if open close it then reopen so i know the exact 
state of the port. I think its not helping running from pythonwin IDE.
id also like to interegate the port error messages(as displayed on the 
interactive window), trap it and deal with it rather than just bomb out.

Chris Liechti wrote:
> vector <Vector180W at netscape.net> wrote in 
> news:3E76867F.3080002 at netscape.net:
> 
>>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
> 





More information about the Python-list mailing list