[ python-Bugs-777884 ] minidom.py -- TypeError: object doesn't support slice assig

SourceForge.net noreply at sourceforge.net
Tue Nov 22 22:21:41 CET 2005


Bugs item #777884, was opened at 2003-07-25 20:22
Message generated for change (Comment added) made by akuchling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=777884&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: XML
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Mark Lesh (leshmark)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: minidom.py -- TypeError: object doesn't support slice assig

Initial Comment:
Got the following traceback after upgrading to 2.3c1

Traceback (most recent call last):
  File
"/root/alchemy/scripts/cvs/alchemy/alchemy_menu.py",
line 178, in menu_system
    a=alchemy.Alchemy(name=name,step='alchemy')
  File "/root/alchemy/scripts/cvs/alchemy/alchemy.py",
line 89, in __init__
   
self.traverseNodes([self.start_node],exclude_tags=["evaporate","info"])
  File "/root/alchemy/scripts/cvs/alchemy/alchemy.py",
line 786, in traverseNodes
    self.traverseNodes(node.childNodes,exclude_tags)
  File "/root/alchemy/scripts/cvs/alchemy/alchemy.py",
line 786, in traverseNodes
    self.traverseNodes(node.childNodes,exclude_tags)
  File "/root/alchemy/scripts/cvs/alchemy/alchemy.py",
line 786, in traverseNodes
    self.traverseNodes(node.childNodes,exclude_tags)
  File "/root/alchemy/scripts/cvs/alchemy/alchemy.py",
line 786, in traverseNodes
    self.traverseNodes(node.childNodes,exclude_tags)
  File "/root/alchemy/scripts/cvs/alchemy/alchemy.py",
line 786, in traverseNodes
    self.traverseNodes(node.childNodes,exclude_tags)
  File "/root/alchemy/scripts/cvs/alchemy/alchemy.py",
line 786, in traverseNodes
    self.traverseNodes(node.childNodes,exclude_tags)
  File "/root/alchemy/scripts/cvs/alchemy/alchemy.py",
line 766, in traverseNodes
    node.normalize()
  File "/usr/lib/python2.3/xml/dom/minidom.py", line
208, in normalize
    self.childNodes[:] = L
TypeError: object doesn't support slice assignment


----------------------------------------------------------------------

>Comment By: A.M. Kuchling (akuchling)
Date: 2005-11-22 16:21

Message:
Logged In: YES 
user_id=11375

I can trigger this exception by calling the normalize()
method on a childless DOM node such as Text.  A little
script is attached. 

The question is: what should normalize() do for a class such
as Text?  Looking at the DOM Level 1 specification,
.normalize() is actually part of the Element interface, not
Node, so things like Text.normalize() wouldn't work at all.

One solution: move normalize() onto the Element class. 
Possibly backwards-incompatible.

Another solution: add a normalize() method to the Childless
mix-in that raises an exception.


----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2003-08-01 03:00

Message:
Logged In: YES 
user_id=21627

It would definitely help if you could provide more detail on
the nature of the failure. E.g. where did the DOM tree come
from that Alchemy tries to invoke .normalize on, and what is
self.childnodes in the place of the error. 

If you could instead submit a small example that allows
reproduction of the error, that would help as well.

----------------------------------------------------------------------

Comment By: Mark Lesh (leshmark)
Date: 2003-08-01 02:20

Message:
Logged In: YES 
user_id=76540

The code worked again after I downgraded to Python 2.2.3. If
you like I can replicate in a shorter and includable code
snippet (I'd need to pop 2.3 back on my box first though)

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2003-07-27 07:10

Message:
Logged In: YES 
user_id=21627

Are you sure this is a bug in Python, and not in Alchemy?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=777884&group_id=5470


More information about the Python-bugs-list mailing list