Can we send and receive data to and from Port Using Python ?

Steve Holden steve at
Fri Apr 11 14:52:46 CEST 2008

sambasivareddy wrote:
> Hi,
> I am new to this group. I have some question, it is listed below.
> In my application I should send some data to hardware and it will give 
> response that response should log in one file. To do it first should 
> send data to port next receive response from port (hardware) so...
> __
> _Queries:_
> 1) Can we able to send data to serial port using python? If yes how?

   The usual mechanism is the pyserial module. Google is your friend.

> 2) Can we able to receive data from serial port using python? If yes how?

   See answer to 1)

> 3) Is there any function like "Register event call back”, please explain?
> (Register event call back: registers a script to be called when an event 
> occurs)

   I believe you need to implement the observer pattern. There have
   already been several successful implementations of this, and
   again Google should be capable of finding them. For example:

> 4) Is it possible "parallel loops" concept in python (In my application 
> send data to port and receive data should be in one file and execute at 
> same time)?

   Most Python implementations support threading, and there are a
   number of other asynchronous service techniques. There should
   be absolutely no problem.

> If anyone knows answers please clarify and have any examples related to 
> this please send it .if u need any information regarding questions 
> please let me know.
> Thanks in advance.
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC    

More information about the Python-list mailing list