[PyQt] Problem with threaded ftp: Cannot queue arguments of type 'QUrlInfo'
Phil Thompson
phil at riverbankcomputing.com
Tue Nov 20 10:21:31 GMT 2012
On Fri, 16 Nov 2012 14:40:10 -0800, Brian Knudson <briank at pipelinefx.com>
wrote:
> Certainly, I'm doing something wrong, but I must be missing it.
>
> I've made a little demo script that downloads a file from ftp & updates
a
> progress bar while doing so. The downloading & updating the progress
bar
> works fine, however, I'm trying to do the next step which is to take a
url
> that looks like "ftp://foo.com/bar/*", in which case I would list the
> contents of the directory, then do a get on the returned files.
>
> At the moment, I'm just trying to do a list on any directory & print the
> results to the command line.
>
> When I try to do a listInfo.connect, I get an error message:
>
> QObject::connect: Cannot queue arguments of type 'QUrlInfo'
> (Make sure 'QUrlInfo' is registered using qRegisterMetaType().)
>
> ... as I understand it, qRegisterMetaType is not something that can be
> done in PyQt & is also a sign of a fundamental problem, and herein lies
my
> problem. I can do a commandFinished.connect and
> dataTransferProgress.connect without issue, but listInfo.connect doesn't
> seem to work (as I would expect it).
>
> Any ideas how to correct this?
It's arguably a Qt bug - it should call qRegisterMetaType() itself for any
types used in signal arguments.
> Here's some example code (pardon the length). I would like to be able
to
> print the listed files/urls from the function "lister". Ultimately, I'd
> like to then have that function formulate new urls & pass them back to
> connectAndDownload to download each of the files (of course, this will
> require modifications to connectAndDownload, but we're not there yet).
Why use threads at all? QFtp is asynchronous and won't block. If you need
to do some blocking processing of the results then create threads for that.
Phil
More information about the PyQt
mailing list