Sorry, I could not describe my problem much better in the title.
I am trying to learn Python and came across this strange behavior and hoped that someone could explain this to me.
I am running Ubuntu 8.10 and python 2.5.2
First I import xml.dom
Then I create an instance of the minidom (using its fully qaulified name xml.dom.minidom)
This fails, but if I run the same line again, it will work! See below:
$> python
Python 2.5.2 (r252:60911, Oct 5 2008, 19:29:17)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml.dom
>>> xml.dom.minidom.parseString("<xml><item/></xml>")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'minidom'
>>> xml.dom.minidom.parseString("<xml><item/></xml>")
<xml.dom.minidom.Document instance at 0x7fd914e42fc8>
I tried on another machine, and if successively fails.
source
share