Python pydot.graph_from_dot_file() Examples

The following are 2 code examples of pydot.graph_from_dot_file(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pydot , or try the search function .
Example #1
Source File: pydot_unittest.py    From pydot with MIT License 5 votes vote down vote up
def _render_with_pydot(self, filename, encoding):
        c = pydot.graph_from_dot_file(filename, encoding=encoding)
        sha = ''
        for g in c:
            jpe_data = g.create(prog=TEST_PROGRAM, format='jpe', encoding=encoding)
            sha += sha256(jpe_data).hexdigest()
        return sha 
Example #2
Source File: vizoozie.py    From ibis with Apache License 2.0 5 votes vote down vote up
def convertDotToPDF(self, dot_string, name):
        """Writes the dot string to a .dot file than creates
        a pdf from the dot file"""
        dot = name + '.dot'
        dot = os.path.join(self.cfg_mgr.files, dot)
        dot_output = open(dot, 'w')
        dot_output.write(str(dot_string))
        dot_output.close()
        png = os.path.join(self.cfg_mgr.files, name + '.pdf')
        # Write out the pdf file - note that there are many other options
        graph = pydot.graph_from_dot_file(dot)
        graph.write(png, format='pdf')