Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'anyway.': 0.05; 'one?': 0.05; 'data:': 0.09; 'except:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'skip:# 30': 0.09; 'try:': 0.09; 'def': 0.12; 'random': 0.14; 'latter,': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'segfault': 0.16; 'subject:Problems': 0.16; 'subject:port': 0.16; 'sure.': 0.16; 'true:': 0.16; 'wrote:': 0.18; 'seems': 0.21; 'example': 0.22; 'header:User-Agent:1': 0.23; 'finally,': 0.24; 'replace': 0.24; 'file.': 0.24; 'script': 0.25; 'pass': 0.26; 'post': 0.26; 'header:X-Complaints-To:1': 0.27; 'external': 0.29; "i'm": 0.30; 'class': 0.32; 'run': 0.32; 'text': 0.33; 'skip:_ 10': 0.34; 'skip:d 20': 0.34; "i'd": 0.34; 'problem': 0.35; 'subject:with': 0.35; 'possible.': 0.35; 'something': 0.35; 'but': 0.35; 'really': 0.36; 'next': 0.36; 'useful': 0.36; 'too': 0.37; 'two': 0.37; 'step': 0.37; 'problems': 0.38; 'to:addr:python- list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'remove': 0.60; 'temporarily': 0.60; 'simple': 0.61; 'email addr:gmail.com': 0.63; 'limit': 0.70; 'increase': 0.74; 'bare': 0.84; 'complexity': 0.84; 'quote,': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: Problems with serial port interface Date: Fri, 07 Jun 2013 13:23 +0200 Organization: None References: <8cf25b92-f4c5-43ac-a285-240abc6ee3e7@googlegroups.com> <1f18bcf1-57b5-474a-b5d4-d5b51ef859c1@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p50849e8e.dip0.t-ipconnect.de User-Agent: KNode/4.7.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 48 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1370604202 news.xs4all.nl 15942 [2001:888:2000:d::a6]:37704 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:47325 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.