Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8141529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:32:25+00:00 2026-06-06T12:32:25+00:00

I am working on a project in which I need to download and parse

  • 0

I am working on a project in which I need to download and parse an XML file from a network location. I’ve been trying to use the QtNetwork module to accomplish this, but I’m running into a seemingly simple problem that I’ve spent many hours trying to solve. My code is as follows:

class NetworkAccessor(QObject):
    done = False
    def importXml(self):
        self.manager = QNetworkAccessManager()
        self.manager.finished.connect(self.fileReady(QNetworkReply))
        self.manager.get(QNetworkRequest(QUrl("http://192.168.5.243/details.xml")))

    def fileReady(self, response):
        self.f = QTemporaryFile()
        print type(response)
        self.f.write(response.readAll())
        self.done = True
        print "Done"

When I instantiate the NetworkAccessor class and call importXml, I get the following error:

Traceback (most recent call last):
File "C:/SVN-Local/Thermal/PyQtTestTemplate.py", line 40, in updateUi
f = networkAccessor.importXml()
File "C:/SVN-Local/Thermal/PyQtTestTemplate.py", line 14, in importXml
self.connect(self.manager,SIGNAL("finished(QNetworkReply*)"),self.fileReady(QNetworkReply))
File "C:/SVN-Local/Thermal/PyQtTestTemplate.py", line 20, in fileReady
self.f.write(response.readAll())
TypeError: QIODevice.readAll(): first argument of unbound method must have type 'QIODevice'

It seems to indicate that the argument passed to the fileReady method is not instantiated. Furthermore, the print type(response) statement above indicates that response is of type PyQt4.QtNetwork.QNetworkReply.

I’ve tried various ways of connecting the signal to the slot including the “old fashioned” way: self.connect(self.manager,SIGNAL("finished(QNetworkReply*)"),self.fileReady("QNetworkReply")) as well as using short-circuit parameter passing with no success.

Can somebody show me the proper way to pass an instantiated instance of a QNetworkReply object from a signal to a slot?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:32:27+00:00Added an answer on June 6, 2026 at 12:32 pm

    Just pass it the slot, the QNetworkReply object will get passed through by the signal:

    self.manager.finished.connect(self.fileReady)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I am working with the project in which I need to parse complex
I am currently working on a project in which I need to use a
I am working on a project in which I need sync RSS feed from
I'm working on a project in which I need to produce messages from node.js
I am working on a project in which I need to generate 8 random
I'm working on a project in which I need to process a huge amount
I am working on a project in which I need to change the time
Currently we are working on a project in which we need to come up
I am working on a homework project in which we need to generate a
Iam working on a project which involves writing a Mork File (Mork is a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.