Re: Problem with two instances of PySerial

2009-07-13 Thread Grant Edwards

 On Thu, 9 Jul 2009 08:40:18 -0500, Shine Jose shinejos...@gmail.com wrote:

 I achieve this by creating a separate worker thread to poll
 the serial port for arrival of data and then updating the
 required widget in main thread of program. For polling the
 serial port, I create a separate instance of pySerial object.
 However, I am unable to read any data in the worker thread.
 Can the reason for this be 2 instances of pySerial objects
 being connected to serial port.

Yes.

 The reason I had this doubt was because Serial.Connect() in
 the worker thread did not throw any exception  isOpen()
 method returns true.

Under Unix, you are allowed to open a device or file as many
times as you want (there are some common cases where there is a
very useful thing to do).  However, for something like a serial
port, there's only one copy of each received data byte.
Depending on exactly how you structure your code, the incoming
data may be divided up amongst multiple readers, or one
particular reader may get all of it.

-- 
Grant Edwards   grante Yow! I joined scientology
  at   at a garage sale!!
   visi.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Problem with two instances of PySerial

2009-07-09 Thread Shine Jose
Hello friends,I am developing an application to read data from serial port
and display it on the screen using GUI developed in pyQT. For this I have
instantiated the GUI as well as pySerial objects in the main thread. I have
provided a button 'Read' which when clicked by the user reads from the
serial port using read() method of pySerial. However, for debugging purposes
I also want to poll the serial port continuously for arrival of data and
display on screen. I achieve this by creating a separate worker thread to
poll the serial port for arrival of data and then updating the required
widget in main thread of program. For polling the serial port, I create a
separate instance of pySerial object. However, I am unable to read any data
in the worker thread. Can the reason for this be 2 instances of pySerial
objects being connected to serial port. The reason I had this doubt was
because Serial.Connect() in the worker thread did not throw any exception 
isOpen() method returns true.
I request you to help me in figuring out the problem.

-- 
Regards,
Shine Jose
-- 
http://mail.python.org/mailman/listinfo/python-list