Pyserial never read

Grant Edwards grante at visi.com
Wed Feb 22 12:40:26 EST 2006


On 2006-02-22, sam <samschul at pacbell.net> wrote:
> luca72 wrote:
>> Thanks to all for the help,
>>
>> here you find the code, pls note if i use handshaking = 1 the
>> application don't start.
>> in the delphi configuratio of com port if i use or not handshaking the
>> application work.
>> Best Regards at all
>>
>> Luca
>>
>> import serial
>>         import win32file
>>         port = 2
>
> Is port = 2 correct?

Read the fine documentation at http://pyserial.sourceforge.net/:

     Parameters for the Serial class
     
     ser = serial.Serial(
         port=None,              #number of device, numbering starts at
                                 #zero. if everything fails, the user
                                 #can specify a device string, note
                                 #that this isn't portable anymore
                                 #if no port is specified an unconfigured
                                 #an closed serial port object is created
         baudrate=9600,          #baudrate
         bytesize=EIGHTBITS,     #number of databits
         parity=PARITY_NONE,     #enable parity checking
         stopbits=STOPBITS_ONE,  #number of stopbits
         timeout=None,           #set a timeout value, None for waiting forever
         xonxoff=0,              #enable software flow control
         rtscts=0,               #enable RTS/CTS flow control
     )
     
> I thought that com ports under windows are designated as a string
> "com1","com2",..etc.

You can use those as well, but they're non-portable.  
serial.Serial(port=0) will open the first serial port on either
windows or linux.

-- 
Grant Edwards                   grante             Yow!  Ha ha  Ha ha Ha ha
                                  at               Ha Ha Ha Ha -- When will I
                               visi.com            EVER stop HAVING FUN?!!



More information about the Python-list mailing list