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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:15:50+00:00 2026-06-14T17:15:50+00:00

I keep getting the followinge error whenever there is a function call to xml(productline)

  • 0

I keep getting the followinge error whenever there is a function call to xml(productline), but if I replace the functioncall with file = open('config\\' + productLine + '.xml','r'), it seems to work, why?

def xml(productLine):
         with open('config\\' + productLine + '.xml','r') as f:
    return f.read()


def getsanityresults(productline):

xmlfile=xml(productline) // replace with file = open('config\\' + productLine + '.xml','r')
dom = minidom.parse(xmlfile)
data=dom.getElementsByTagName('Sanity_Results')
#print "DATA"
#print data
textnode = data[0].childNodes[0]
testresults=textnode.data
#print testresults
for line in testresults.splitlines():
    #print line
    line = line.strip('\r,\n')
    #print line
    line = re.sub(r'(http://[^\s]+|//[^\s]+|\\\\[^\s]+)', r'<a href="\1">\1</a>', line)
    print line
    #print line       
    resultslis.append(line)
print resultslis
return resultslis

Error:

Traceback (most recent call last):
 File "C:\Dropbox\scripts\announce_build_wcn\wcnbuild_release.py", line 910, in <module>
  main()
 File "C:\Dropbox\scripts\announce_build_wcn\wcnbuild_release.py", line 858, in main
testresults=getsanityresults(pL)
 File "C:\Dropbox\scripts\announce_build_wcn\wcnbuild_release.py", line 733, in   getsanityresults
  dom = minidom.parse(xmlfile)
File "C:\python2.7.3\lib\xml\dom\minidom.py", line 1920, in parse
   return expatbuilder.parse(file)
File "C:\python2.7.3\lib\xml\dom\expatbuilder.py", line 922, in parse
fp = open(file, 'rb')
IOError: [Errno 2] No such file or directory: '<root>\n    <PL name = "MSM8930.LA.2.0-PMIC-8917">\n
  • 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-14T17:15:51+00:00Added an answer on June 14, 2026 at 5:15 pm

    minidom.parse() expects either filename or file-object as a parameter but you are passing the content of the file, try this:

    import os
    from xml.dom import minidom
    
    doc = minidom.parse(os.path.join('config', productline + '.xml'))
    

    Unless you have specific requirements that favors minidom; use xml.etree.cElementTree to work with xml in Python. It is more pythonic and lxml that you might need in more complex cases supports its API so you don’t need to learn twice.

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

Sidebar

Related Questions

Basically I tried evaluating the function below but keep getting the following error: WARNING
I keep getting this error whenever I tried to validate the rdf file in
I keep getting the following error when trying to write a template function: main.cpp|17|error:
I'm trying to bake my controllers but I keep getting the following error: It's
I've tried many configurations, but I keep getting the following error upon opening eclipse:
I'm trying to build a form using symfony2, but I keep getting the error
I keep getting the error not authorized whenever i try to visit: appname.herokuapp.com/admin_data I've
I keep getting the following error: $ ./test.py -bash: ./test.py: cannot execute binary file
I am following this example . I keep getting this error whenever calling upon
I am validating email address using php with preg_match function. But I keep getting

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.