When I run the 'exploded-graph-rewriter.py' tool on Windows using Python 3.5 and above, the following error and stack trace occurs:
Traceback (most recent call last): File "C:\Work\Dev\llvm\llvm-monorepo\clang\utils\analyzer\exploded-graph-rewriter.py", line 1061, in <module> main() File "C:\Work\Dev\llvm\llvm-monorepo\clang\utils\analyzer\exploded-graph-rewriter.py", line 1057, in main explorer.explore(graph, visitor) File "C:\Work\Dev\llvm\llvm-monorepo\clang\utils\analyzer\exploded-graph-rewriter.py", line 911, in explore visitor.visit_end_of_graph() File "C:\Work\Dev\llvm\llvm-monorepo\clang\utils\analyzer\exploded-graph-rewriter.py", line 879, in visit_end_of_graph svg = graphviz.pipe('dot', 'svg', self.output()) File "C:\Program Files\Python37\lib\site-packages\graphviz\backend.py", line 229, in pipe out, _ = run(cmd, input=data, capture_output=True, check=True, quiet=quiet) File "C:\Program Files\Python37\lib\site-packages\graphviz\backend.py", line 166, in run out, err = proc.communicate(input) File "C:\Program Files\Python37\lib\subprocess.py", line 920, in communicate stdout, stderr = self._communicate(input, endtime, timeout) File "C:\Program Files\Python37\lib\subprocess.py", line 1238, in _communicate self._stdin_write(input) File "C:\Program Files\Python37\lib\subprocess.py", line 854, in _stdin_write self.stdin.write(input) TypeError: a bytes-like object is required, not 'str'
Due to work with Unicode in Python beginning from 3.5, the output string must be encoded, so I put the code to detect whether the script works on Python 3.5+ and use the encode() method if so. After this manipulations, the exploded-graph-rewriter.py script works fine on Windows and Python 3.7.
I haven't tried the script on Python 2