using QFtp class in PyQT

Discussion in 'Python' started by Kim, Apr 19, 2004.

  1. Kim

    Kim Guest

    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(*arg):
    print "List info ",arg

    def doFTP():
    fh = QFtp()
    QObject.connect(fh,SIGNAL("start()"),gotSignalStart);
    QObject.connect(fh,SIGNAL("stateChanged()"),gotSignalState);
    QObject.connect(fh,SIGNAL("listInfo()"),gotListInfo);
    fh.connectToHost("ftp.trolltech.com")
    fh.login()
    print fh.state()
    if fh.state() != QFtp.Unconnected : fh.close()

    doFTP();

    Error messages:

    QObject::connect: No such signal QFtp::start()
    QObject::connect: (sender name: 'unnamed')
    QObject::connect: (receiver name: 'unnamed')
    QObject::connect: No such signal QFtp::stateChanged()
    QObject::connect: (sender name: 'unnamed')
    QObject::connect: (receiver name: 'unnamed')
    QObject::connect: No such signal QFtp::listInfo()
    QObject::connect: (sender name: 'unnamed')
    QObject::connect: (receiver name: 'unnamed')
    0
    QSocket::writeBlock: Socket is not open


    Can anyone help?
    Thanks very much
    Kim
    Kim, Apr 19, 2004
    #1
    1. Advertising

  2. On Monday 19 April 2004 2:59 pm, Kim wrote:
    > 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(*arg):
    > print "List info ",arg
    >
    > def doFTP():
    > fh = QFtp()
    > QObject.connect(fh,SIGNAL("start()"),gotSignalStart);
    > QObject.connect(fh,SIGNAL("stateChanged()"),gotSignalState);
    > QObject.connect(fh,SIGNAL("listInfo()"),gotListInfo);
    > fh.connectToHost("ftp.trolltech.com")
    > fh.login()
    > print fh.state()
    > if fh.state() != QFtp.Unconnected : fh.close()
    >
    > doFTP();
    >
    > Error messages:
    >
    > QObject::connect: No such signal QFtp::start()
    > QObject::connect: (sender name: 'unnamed')
    > QObject::connect: (receiver name: 'unnamed')
    > QObject::connect: No such signal QFtp::stateChanged()
    > QObject::connect: (sender name: 'unnamed')
    > QObject::connect: (receiver name: 'unnamed')
    > QObject::connect: No such signal QFtp::listInfo()
    > QObject::connect: (sender name: 'unnamed')
    > QObject::connect: (receiver name: 'unnamed')
    > 0


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

    SIGNAL("listInfo(const QUrlInfo &)")

    > QSocket::writeBlock: Socket is not open


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

    Phil
    Phil Thompson, Apr 19, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. E11
    Replies:
    1
    Views:
    4,736
    Thomas Weidenfeller
    Oct 12, 2005
  2. jd
    Replies:
    3
    Views:
    349
  3. ulysses
    Replies:
    4
    Views:
    764
    Werner Schiendl
    Oct 22, 2003
  4. Sibylle Koczian
    Replies:
    2
    Views:
    543
    Sibylle Koczian
    May 25, 2004
  5. Christopher Stone

    Implementing a QFilePreview Class with PyQt

    Christopher Stone, Jun 27, 2004, in forum: Python
    Replies:
    1
    Views:
    380
Loading...

Share This Page