Opened 12 years ago

Closed 12 years ago

#2076 defect closed duplicate (duplicate)

twisted from svn will traceback when run on platform without working xml.dom.minidom

Reported by: Stephen Thorne Owned by: Stephen Thorne
Priority: highest Milestone:
Component: core Keywords:
Cc: Branch:


When twisted starts up, it checks if it's in a svn checkout and then gets the svn revision out to use in the version string. If the platform doesn't have xml.dom.minidom, this will traceback with an ImportError.

Removing this hard-dependancy on xml.dom.minidom would be nice.

Change History (4)

comment:1 Changed 12 years ago by Stephen Thorne

Keywords: review added

Here is a patch.

shiny:~/src/Twisted/trunk stephen$ svn diff twisted/python/
Index: twisted/python/
--- twisted/python/  (revision 18057)
+++ twisted/python/  (working copy)
@@ -86,7 +86,11 @@
             if os.path.exists(ent):
-                from xml.dom.minidom import parse
+                try:
+                    from xml.dom.minidom import parse
+                except ImportError:
+                    # On a platform without xml.dom.minidom
+                    return
                 doc = parse(file(ent)).documentElement
                 for node in doc.childNodes:
                     if hasattr(node, 'getAttribute'):

comment:2 Changed 12 years ago by Jonathan Lange

Keywords: review removed
Owner: changed from Glyph to Stephen Thorne
Priority: normalhighest

Looks good to me. If it passes tests, then merge. Consider adding a docstring to _getSVNVersion.

comment:3 Changed 12 years ago by Jean-Paul Calderone

This was merged and reverted, since it doesn't fix the problem.

comment:4 Changed 12 years ago by Stephen Thorne

Resolution: duplicate
Status: newclosed

This bug is the same issue as in #1968.

Note: See TracTickets for help on using tickets.