[PyQt] QHttpMultiPart impossible to use

Phil Thompson phil at riverbankcomputing.com
Wed Jun 20 14:04:45 BST 2012


On Tue, 19 Jun 2012 18:10:31 -0700, Doogster <thedoogster at gmail.com>
wrote:
> How does one use PyQt's QHttpMultiPart and QHttpPart classes?
> 
> On both Arch Linux (PyQt 4.9) and Windows (4.8.1, I believe), the
> attached code sample segfaults the Python interpreter.

As has been pointed out you need to keep a reference to the QHttpMultiPart
object (or give it a parent).

> While Qt's QNetworkAccessManager::post() method is overloaded to take
> a pointer to a QHttpMultiPart, PyQt's QNetworkAccessManager.post()
> method only has overloads to take either a QByteArray or a QIODevice.

If this was true then you would get a type exception when running your
script.

> Therefore, it does not appear to be possible to use a PyQt
> QHttpMultiPart instance the way it was intended to be used.
> 
> Finally, the current PyQt Class Reference does not mention the
> QHttpMultiPart and QHttpPart classes.

That will be fixed in the next release.

> What's going on? Is this a bug in PyQt?

Phil


More information about the PyQt mailing list