using QFtp class in PyQT

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kim

    using QFtp class in PyQT

    Hi everybody,
    I tried to write simple FTP program using PyQt version 3.11. The
    document say that QFtp has been implemented, but i keep getting error
    message from my simple program :

    My Program:

    from qt import *
    from qtnetwork import *

    def gotSignalStart( *arg):
    print "start ",arg

    def gotSignalState( *arg):
    print "state ",arg

    def gotListInfo(*ar g):
    print "List info ",arg

    def doFTP():
    fh = QFtp()
    QObject.connect (fh,SIGNAL("sta rt()"),gotSigna lStart);
    QObject.connect (fh,SIGNAL("sta teChanged()"),g otSignalState);
    QObject.connect (fh,SIGNAL("lis tInfo()"),gotLi stInfo);
    fh.connectToHos t("ftp.trolltec h.com")
    fh.login()
    print fh.state()
    if fh.state() != QFtp.Unconnecte d : fh.close()

    doFTP();

    Error messages:

    QObject::connec t: No such signal QFtp::start()
    QObject::connec t: (sender name: 'unnamed')
    QObject::connec t: (receiver name: 'unnamed')
    QObject::connec t: No such signal QFtp::stateChan ged()
    QObject::connec t: (sender name: 'unnamed')
    QObject::connec t: (receiver name: 'unnamed')
    QObject::connec t: No such signal QFtp::listInfo( )
    QObject::connec t: (sender name: 'unnamed')
    QObject::connec t: (receiver name: 'unnamed')
    0
    QSocket::writeB lock: Socket is not open


    Can anyone help?
    Thanks very much
    Kim
  • Phil Thompson

    #2
    Re: using QFtp class in PyQT

    On Monday 19 April 2004 2:59 pm, Kim wrote:[color=blue]
    > Hi everybody,
    > I tried to write simple FTP program using PyQt version 3.11. The
    > document say that QFtp has been implemented, but i keep getting error
    > message from my simple program :
    >
    > My Program:
    >
    > from qt import *
    > from qtnetwork import *
    >
    > def gotSignalStart( *arg):
    > print "start ",arg
    >
    > def gotSignalState( *arg):
    > print "state ",arg
    >
    > def gotListInfo(*ar g):
    > print "List info ",arg
    >
    > def doFTP():
    > fh = QFtp()
    > QObject.connect (fh,SIGNAL("sta rt()"),gotSigna lStart);
    > QObject.connect (fh,SIGNAL("sta teChanged()"),g otSignalState);
    > QObject.connect (fh,SIGNAL("lis tInfo()"),gotLi stInfo);
    > fh.connectToHos t("ftp.trolltec h.com")
    > fh.login()
    > print fh.state()
    > if fh.state() != QFtp.Unconnecte d : fh.close()
    >
    > doFTP();
    >
    > Error messages:
    >
    > QObject::connec t: No such signal QFtp::start()
    > QObject::connec t: (sender name: 'unnamed')
    > QObject::connec t: (receiver name: 'unnamed')
    > QObject::connec t: No such signal QFtp::stateChan ged()
    > QObject::connec t: (sender name: 'unnamed')
    > QObject::connec t: (receiver name: 'unnamed')
    > QObject::connec t: No such signal QFtp::listInfo( )
    > QObject::connec t: (sender name: 'unnamed')
    > QObject::connec t: (receiver name: 'unnamed')
    > 0[/color]

    You must give the full (C++) signature of the signal, eg...

    SIGNAL("listInf o(const QUrlInfo &)")
    [color=blue]
    > QSocket::writeB lock: Socket is not open[/color]

    QFtp is asynchronous. You need an event loop to make sure things actually
    happen.

    Phil

    Comment

    Working...