[PyQt] got stuck translating webftpclient example to PyQt

Moritz Warning moritzwarning at web.de
Sat Feb 8 21:10:55 GMT 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/08/2014 07:56 PM, Hans-Peter Jansen wrote:
> On Samstag, 8. Februar 2014 18:32:07 you wrote:
>> On 02/07/2014 10:08 AM, Hans-Peter Jansen wrote:
>>> Hi Moritz,
>>>
>>> On Freitag, 7. Februar 2014 00:58:26 Moritz Warning wrote:
>>>> On 02/04/2014 10:49 AM, Hans-Peter Jansen wrote:
>>>>> On Dienstag, 4. Februar 2014 09:49:54 Moritz Warning wrote:
>>>>>> It is probably the same bug that was reported here:
>>>>>> https://bugreports.qt-project.org/browse/QTBUG-27469
>>>>>
>>>>> Most probably, yes.
>>>>>
>>>>>> I tried to bisect the error, but failed to do so yet.
>>>>>
>>>>> You're lucky, if QWebKit is bisectible at all. Do you have a known good
>>>>> version to start with?
>>>>>
>>>>> Please leave a comment about the dysfunctional webftpclient in
>>>>> QTBUG-27469
>>>>> at least.
>>>>>
>>>>> Pete
>>>>
>>>> I've narrowed it down quite a lot.
>>>
>>> Good work.
>>>
>>>> But it needs quite some deeper understanding to fix this bug.
>>>
>>> Hopefully somebody with some deeper understanding of the Qt IO system will
>>> stand up and manage to fix it..
>>>
>>> OTOH, it smells, like the _integration_ of the new WebKit for Qt 4.8
>>> failed in some way.
>>>
>>> Pete
>>
>> The bug in the webftpclient example is resolved now:
>> See https://bugreports.qt-project.org/browse/QTBUG-27469
>>
>> The fixed webftpclient example using PyQt is available here:
>> https://github.com/mwarning/PyQt4-Examples/commits/master
> 
> Good work, Moritz.
> 
> After fixing the obvious bugs:
> 	
> 	https://github.com/mwarning/PyQt4-Examples/pull/1
> 
> there's one problem left:
> 
> Clicking on copyrightnotice.txt should display the content of the file, as done in a fixed 
> c++ example code, but it just prints:
> 
> 	TypeError: invalid result type from FtpReply.readData()
> 
> The c++ code returns a -1, but QtCore/qiodevice.sip notes, that None is returned for the 
> error case. I guess, this is true for the exhausted case, too.
> 
> I don't see any more obvious problems with your code, hence this might be a PyQt error.
> 
> Phil, if you want to take a look, you can pull from here:
> 
> 	https://github.com/frispete/PyQt4-Examples.git
> 
> Run python main.py, and click on copyrightnotice.txt.
> 
> Cheers,
> Pete
> 

The problem there is that readAll() in ftpreply.py assigns a QByteArray to self.content.
The slice of self.content in readData is also a QByteArray, but PyQt expects it to be a str.
I have wrapped the returned data in a str call in the recent commit.

A problem that seems to be left is that startDownload is not called.
But that is something for another day. :)

- - mwarning
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iQEcBAEBAgAGBQJS9p1fAAoJECHrh56PP4wpUuoIAJJ3WR4jSd2BwhSJMaGloqqD
btDqphLetZ2c2zl4KP2Xg8tT6pWEpdjvq+3Rpra/koM/8FNEdCY1s9ijZZ/Pjq+O
UBEEwgQoqIMu8fTf8EBBnDmCkNwcWG9+XO9HiSn1FI1CJxAv7dlFXbmXwuH5AV0i
9PZDx+q0yX2FID5EqJDGkwlXJGeLKhRLfnjRUC79XyUiRbXlSK80n4m1IS65421Y
J/dmf9AJ/ElvcRTc2ZQ7HTbsS74hMAN058PtN5IXxGFBck/pXVF+1UjtPKIYyB/A
kpH3AR7yJxvzBGFP/O6KGtnBxOkgChUNCudZHXJK1mEIMfsUYWxBcjqH3djS8Es=
=NHht
-----END PGP SIGNATURE-----


More information about the PyQt mailing list