mikezang
asked on
What does error "AttributeError: 'NoneType' object has no attribute 'parse'" mean?
I use some code as below:
from xml.dom import minidom
xmldoc1 = minidom.parse('my.xml')
When I run it, I got error as below:
load_module xml
load_module xml.dom
load_module xml.dom.minidom
load_module xml.dom.expatbuilder
xml.dom.expatbuilder import failed
Traceback (most recent call last):
File "<string>", line 1, in ?
File "<string>", line 52, in load_module
File "CvEventInterface", line 13, in ?
File "<string>", line 52, in load_module
File "CvEventManager", line 12, in ?
File "<string>", line 52, in load_module
File "CvScreensInterface", line 16, in ?
File "<string>", line 52, in load_module
File "CvOptionsScreen", line 17, in ?
File "C:\Python24\lib\xml\dom\m inidom.py" , line 1915, in parse
return expatbuilder.parse(file)
AttributeError: 'NoneType' object has no attribute 'parse'
Does anyone help me?
from xml.dom import minidom
xmldoc1 = minidom.parse('my.xml')
When I run it, I got error as below:
load_module xml
load_module xml.dom
load_module xml.dom.minidom
load_module xml.dom.expatbuilder
xml.dom.expatbuilder import failed
Traceback (most recent call last):
File "<string>", line 1, in ?
File "<string>", line 52, in load_module
File "CvEventInterface", line 13, in ?
File "<string>", line 52, in load_module
File "CvEventManager", line 12, in ?
File "<string>", line 52, in load_module
File "CvScreensInterface", line 16, in ?
File "<string>", line 52, in load_module
File "CvOptionsScreen", line 17, in ?
File "C:\Python24\lib\xml\dom\m
return expatbuilder.parse(file)
AttributeError: 'NoneType' object has no attribute 'parse'
Does anyone help me?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What do you mean "copy xml folder"? That's not the way you normally use python.
What happens if
cd C:\
python
import xml.dom.expatbuilder
If it fails you installation is not good.
What happens if
cd C:\
python
import xml.dom.expatbuilder
If it fails you installation is not good.
ASKER
I think Pythin is istanlled correctly without problems, because when I run code above in folder Python24, I got right result.
There is a application in different folder with its own python24, I added such code to its python source, when I run it, I got error "xml.dom not found".
So that I copy \Python24\lib\xml folder to that application's system folder, this time, the xml.dom.minidom is loaded, but I got error as ablove.
What can I do next?
There is a application in different folder with its own python24, I added such code to its python source, when I run it, I got error "xml.dom not found".
So that I copy \Python24\lib\xml folder to that application's system folder, this time, the xml.dom.minidom is loaded, but I got error as ablove.
What can I do next?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That might be what I need! I will check it tonight!
By the way, Why Python installer dones't set PYTHONHOME auto?
By the way, Why Python installer dones't set PYTHONHOME auto?
ASKER