connecting to serial port + python

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Jul 5 08:41:32 CEST 2007


En Tue, 03 Jul 2007 10:01:51 -0300, Japan Shah <shahjapan at gmail.com>  
escribió:

> I am trying to connect my Nokia 6610 using usb cable,
> I have installed usb-serial driver of it.
> I hv tested it with Hyperterminal and it works fine.
> but when I wrote a python script I am not able to receive the responce
> from the device.
>

>            lines = self.sock.read(100)
If the response contains less than 100 bytes, the above line will block.

> command = ['AT','ATI','ATl1','AT+GMMM']
>
> for cmd in command:
>    conn1.write(str(cmd))

Don't you have to send <ENTER> after each command? "\n"

>    th = connect_serial(conn1)
>    list1.append(th)
>    th.start()

You can't have four threads all reading the same serial port. The device  
sends its responses sequentially anyway.

-- 
Gabriel Genellina




More information about the Python-list mailing list