python - xmltodict throwing errors when used in a .py file -


i want xmltodict in python2.7 , running project have, started copy-pasting example able find

import xmltodict  open ('test.xml') fd:     doc = xmltodict.parse(fd.read())  print doc 

trying run results in error: attributeerror: 'module' object has no attribute 'parse'

same thing when trying convert dict xml using xmltodict.unparse function.

however, works if line line in idle... idea why fails when trying run in .py file, works when use interpreter line line?

just don't name script xmltodict.py. getting imported instead of installed python environment xmltodict package.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -