Commits

jwhe...@jwheatle-WS.cisco.com  committed 7b3ae70

Fixed Python 3 incompatibilities in dot_parser.py

A number of raise, except and print statements were using the Python 2 format,
which caused an error when attempting to import dot_parser using Python 3.

  • Participants
  • Parent commits b48c802

Comments (0)

Files changed (1)

File dot_parser.py

             add_elements(g, element)
             
         else:
-            raise ValueError, "Unknown element statement: %r " % element
+            raise ValueError("Unknown element statement: %r " % element)
     
         
     
                 defaults_edge.update(element.attrs)
 
             else:
-                raise ValueError, "Unknown DefaultStatement: %s " % element.default_type
+                raise ValueError("Unknown DefaultStatement: %s " % element.default_type)
                 
         elif isinstance(element, P_AttrList):
         
             g.obj_dict['attributes'].update(element.attrs)
 
         else:
-            raise ValueError, "Unknown element statement: %r" % element
+            raise ValueError("Unknown element statement: %r" % element)
 
 
 def push_graph_stmt(str, loc, toks):            
     if default_type in ['graph', 'node', 'edge']:
         return DefaultStatement(default_type, attrs)
     else:
-        raise ValueError, "Unknown default statement: %r " % toks
+        raise ValueError("Unknown default statement: %r " % toks)
 
 
 def push_attr_list(str, loc, toks):
         else:
             return [g for g in tokens]
         
-    except ParseException, err:
+    except ParseException as err:
     
-        print err.line
-        print " "*(err.column-1) + "^"
-        print err
+        print(err.line)
+        print(" "*(err.column-1) + "^")
+        print(err)
         return None