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 6535603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:23:34+00:00 2026-05-25T10:23:34+00:00

Trying to grab an xml file from an internet source and parse it for

  • 0

Trying to grab an xml file from an internet source and parse it for some values.
My code:

def get_xml(self):

    #xml_url =   "http://www.shoppingcar.it/feed/export_vel.asp?parametro=1"
    xml_url =   "http://dl.dropbox.com/u/102727/AutoVeloce%20XML%20Splitter/shoppingcar.xml"

    MAX_RETRY = 3
    retry_left = MAX_RETRY

    while retry_left:
        try:
            req =   urlfetch.fetch(xml_url, deadline=10)
            XML =   req.content.decode('windows-1252')
            break   # <- done! got file.

        except (urllib2.HTTPError, DownloadError):
            retry_left -= 1
            logging.error("Error while downloading ShoppingCar.xml, retrying.")
        except DeadlineExceededError:
            retry_left -= 1
            logging.warning("DeadlineExceededError while downloading ShoppingCar.xml, retrying.")
        except Timeout:
            retry_left -= 1
            logging.warning("Timeout while downloading ShoppingCar.xml, retrying.")

    if retry_left and retry_left < MAX_RETRY:
        logging.info("Downloading ShoppingCar.xml succeeded after %s retries.", MAX_RETRY - retry_left)
    if not retry_left:
        logging.error("Downloading ShoppingCar.xml failed after %s retries.", MAX_RETRY)

    return ET.parse(XML)

def _iter_carDicts_in_xml(self, newOnly=True):

    #fails here >
    tree = self.get_xml()

    for veicolo in tree.getiterator('veicolo'):
        # do stuff

Error message I get:

<type 'exceptions.IOError'>: [Errno 13] Permission denied: u'<?xml version="1.0" encoding="windows-1252"?><veicoli>\r\n    <veicolo>\r\n\t\t<id><![CDATA[26806]]></id>

This error continues spitting out the xml file so i won’t paste it all

Really not sure where to go on this one, I’ve used similar code to extract from xml files and never had this kind of problem. Any ideas?

  • 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-05-25T10:23:34+00:00Added an answer on May 25, 2026 at 10:23 am

    parse function expects file object. Try parse(StringIO(XML)) instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to grab some information from a private XML file used as DB
I'm trying to use Nokogiri to grab some data from an XML file, then
Im trying to get some values from the below xml feed <?xml version=1.0 ?>
I'm trying to make a request using dojo.xhrGet to grab some XML data from
I'm trying to parse some XML I've gotten from the Google Data Booksearch API
I'm trying to grab some JSON from Apple's iTunes JSON service. The request is
I've been trying for some hours to grab the response from the imgur API.
I have a weird XML file that I'm trying to parse. <Data> <Row> <Field
I am trying to use CURL to grab an XML file associated with this
I'm trying to configure IIS to parse a .xml file just like it would

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.