Read/write seriel?

Peter Hansen peter at engcorp.com
Sun Feb 16 21:41:45 EST 2003


simon place wrote:
> 
> > claus
> >
> > You don't say which OS you use.  The answer is different for each:
> >
> > Linux:
> >     ser=open("/dev/cua0","r") # depends on distro, could be e.g. ttyS0
> >
> >     Try 'man -k serial'
> >
> > Windows
> >     ser=open("com1","r")
> >
> > Other OSes will differ significantly, and many restrict access to such devices
> > for security reasons.  Try googling for your OS + serial...
> >
> > Happy hunting,
> >
> > -andyj
> >
> > On Monday 03 Feb 2003 1:51 pm, Claus Hemdrup wrote:
> 
> don't think this works, how would python know you didn't want a file
> called "com1" (windows).

Actually, it would work just fine (though doing it this way under
Windows is pretty limited).  Windows (i.e. DOS) knows about devices
named things like COM1, LPT2, PRN, and others (including NUL).

You will not create a file with that name, using Python or anything
else...

-Peter




More information about the Python-list mailing list