Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #47325

Re: Problems with serial port interface

From Peter Otten <__peter__@web.de>
Subject Re: Problems with serial port interface
Date 2013-06-07 13:23 +0200
Organization None
References <8cf25b92-f4c5-43ac-a285-240abc6ee3e7@googlegroups.com> <1f18bcf1-57b5-474a-b5d4-d5b51ef859c1@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.2849.1370604202.3114.python-list@python.org> (permalink)

Show all headers | View raw


lionelgreenstreet@gmail.com wrote:

> Sorry for my quote,
> but do you have any suggestion?

>> After 30seconds (more or less) the program crashes: seems a buffer
>> problem, but i'm not really sure.
>> 
>> What's wrong?

I don't use qt or pyserial myself, but your problem description is too vague 
anyway. Some random remarks:

Does your script segfault or do you get a traceback? If the latter, post it.

As you are using two external libraries, can you limit the problem to a 
single one? For example: temporarily replace pyserial with a file. Do the 
problems persist?

What happens if you remove the bare

try: ...
except: pass

? It may hide useful information.

Finally, can you make a self-contained example that we can run? Make it as 
simple as possible. I'd start with something like

class CReader(QThread):
    def __init__(self, ser):
        self.ser = ser
      
    def run(self):
        while True:
            data = self.ser.read(1)
            if data:
                n = self.ser.inWaiting()
                if n:
                    data += self.ser.read(n)
                text = data.decode('cp1252', 'ignore')
                print(text)
                # adding the following would be the next step
                #self.emit(SIGNAL("newData(QString)"), text)
  
and once you have something that does run you can gradually increase 
complexity until it breaks.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Problems with serial port interface lionelgreenstreet@gmail.com - 2013-06-04 14:25 -0700
  Re: Problems with serial port interface lionelgreenstreet@gmail.com - 2013-06-07 03:17 -0700
    Re: Problems with serial port interface Peter Otten <__peter__@web.de> - 2013-06-07 13:23 +0200
    Re: Problems with serial port interface MRAB <python@mrabarnett.plus.com> - 2013-06-07 15:18 +0100
      Re: Problems with serial port interface lionelgreenstreet@gmail.com - 2013-06-08 11:15 -0700
        Re: Problems with serial port interface lionelgreenstreet@gmail.com - 2013-06-12 01:39 -0700
          Re: Problems with serial port interface lionelgreenstreet@gmail.com - 2013-06-13 01:01 -0700

csiph-web