[PyQt] Weird crashing

David Boddie david at boddie.org.uk
Mon Oct 29 23:22:02 GMT 2007

On Monday 29 October 2007 15:26:17 -0400, Jason Hihn wrote:

> I have an application that works 90% of the time. It is rock-solid on
> desktops, but the 10% is laptop installed base.  The laptops seem to have
> two issues:
> On 1 computer in particular, python.exe crashes whenever you open a
> document outside of the application, such as an Excel file, but it does nto
> crash when a browser is opening cache files. Right after the double click
> but before excel has actually opened, the application crash dialog comes
> up. This violates the notion of private address space and process
> separation. (This is on XP.)

I have no idea how you would track down this kind of bug. If it's a Python
rather than PyQt problem, you might get some answers on one of the python.org
hosted mailing lists. :-(

> The other crazy problem is with QHttp, as far as I can tell. We have a
> function that does a simple get() to obtain the latest version number of
> the software (to see if an update is available) in the "background".  This
> request is performed, but it seems when the response is received it crashes
> the program. Weirder yet, the affected laptops seem to have Verizon
> wireless cards, but not in every case, just most of them. It does not seem
> to matter if they are using VZW or a CAT5 cable.

See my suggestion below, but bear in mind that it may not help if there's
something fundamentally wrong with some other software or hardware.

> I can't imagine what could be causing these issues, I am hoping someone out
> there could see a potential conflict, or some GIL knowledge that I am
> lacking, or if there is some debugging technique that I can use.

If you can produce a minimal working example that exhibits the problem then
that might help. If it's a bug in Qt then it would help if the example is
written in C++, but the HTTP example supplied with Qt might serve this
purpose nicely.

> AFAIK, all this is happening in one thread. The illusion is multitasking
> is created by signals/slots. The crashes were reported in the original
> version using 4.2.3, and are still present in 4.3.1.
> Update code:
>   self.x=QHttp('www.mysite.com')
>   self.buffer=QBuffer(self.bytes, self.x)
>   self.buffer.open(QIODevice.ReadWrite)
>   QObject.connect(self.x, SIGNAL('done(bool)'), self.versionCheckDone)
>   self.x.get('/version.txt')
> def versionCheckDone(self, b):
>   data=str(self.x.readAll())
>   print 'data:', data

Here, I think you should probably read the contents of the buffer instead:

  def versionCheckDone(self, b):

    print 'data:', data

You could also seek and read the buffer if you prefer to do things that way.


More information about the PyQt mailing list