×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    7

    Question QtNetwork.QHttp and PySide wont work

    I am trying to use QtNetwork.QHttp in my N900 using python. Previously my code worked fine, fetched data using get/post methods and so on. But after maemo-upgrade (the big one around ~89MB), it stopped working. I simplified my code to following. The code causes segfault after sleep() when application quits. Same happens in my real application in similar situation. If I comment out all signal-connections, it wont segfault, but it wont do anything useful either (ofcourse). I have upgraded PySide modules and so on and I don't have any other dev/testing libraries installed (atleast I am quite sure about that). Can anybody tell me, what am I doing wrong or is the problem somewhere else?

    Code:
    import sys, os, time
    from PySide import QtCore, QtGui, QtNetwork
    
    class thttp():
        def __init__(self):
            self.http = QtNetwork.QHttp()
            self.http.connect(QtCore.SIGNAL("done(bool)"), self.httpDone)
            self.http.connect(QtCore.SIGNAL("requestStarted(int)"), self.httpRequestStarted)
            self.http.connect(QtCore.SIGNAL("requestFinished(int,bool)"), self.httpRequestFinished)
            self.http.setHost("maemo.org", 80)
    
        def httpDone(error):
            print "done:",error
    
        def httpRequestStarted(id):
            print "started:",id
    
        def httpRequestFinished(id, error):
            print "finished:",id,error
    
    t = thttp()
    t.http.get(str(QtCore.QUrl.toPercentEncoding("/index.html")))
    
    time.sleep(15)

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QtNetwork.QHttp and PySide wont work

    sleep() blocks event loop (which you doesn't seem to start)

    I can find the following code in PySide examples:
    Code:
    __name__ == "__main__":
    
        app = QtGui.QApplication(sys.argv)
    
        sys.exit(app.exec_())

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    7

    Re: QtNetwork.QHttp and PySide wont work

    Ok, that's true (and i forgot to add self in class methods here). But it wont change the fact, that the real application (which has app = QtGui.QApplication(sys.argv) / sys.exit(app.exec_())), wont work. No signals are emitted and so on. I'll try to debug this further. Maybe I have just missed something small.

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QtNetwork.QHttp and PySide wont work

    Just for a record: QHttp was deprecated in Qt 4.4 already.

Similar Threads

  1. How to use OpenGL with PySide (Python-Qt)?
    By TomiS in forum Nokia N9
    Replies: 5
    Last Post: 2010-01-19, 15:08
  2. Replies: 1
    Last Post: 2010-01-04, 14:22

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×