pydot and graphviz error: Couldn't import dot_parser, loading of dot files will not be possible

后端 未结 14 1356
臣服心动
臣服心动 2020-11-28 01:15

When I run a very simple code with pydot

import pydot
graph = pydot.Dot(graph_type=\'graph\')

for i in range(3):

  edge = pydot.Edge(\"king\", \"lord%d\" %         


        
14条回答
  •  [愿得一人]
    2020-11-28 02:01

    pydot used a private module variable (_noncomma) from pyparsing. The below diff fixes it to use for pyparsing 2.0.1:

    diff --git a/dot_parser.py b/dot_parser.py
    index dedd61a..138d152 100644
    --- a/dot_parser.py
    +++ b/dot_parser.py
    @@ -25,8 +25,9 @@ from pyparsing import __version__ as pyparsing_version
     from pyparsing import ( nestedExpr, Literal, CaselessLiteral, Word, Upcase, OneOrMore, ZeroOrMore,
         Forward, NotAny, delimitedList, oneOf, Group, Optional, Combine, alphas, nums,
         restOfLine, cStyleComment, nums, alphanums, printables, empty, quotedString,
    -    ParseException, ParseResults, CharsNotIn, _noncomma, dblQuotedString, QuotedString, ParserElement )
    +    ParseException, ParseResults, CharsNotIn, dblQuotedString, QuotedString, ParserElement )
    
    +_noncomma = "".join( [ c for c in printables if c != "," ] )
    
     class P_AttrList:
    

提交回复
热议问题