diff --git a/gvanim/__main__.py b/gvanim/__main__.py index 8d289fb..24c9dba 100644 --- a/gvanim/__main__.py +++ b/gvanim/__main__.py @@ -18,7 +18,7 @@ from argparse import ArgumentParser, FileType from sys import stdin -import animation, render +from . import animation, render def main(): diff --git a/gvanim/action.py b/gvanim/action.py index e2b0682..69c7680 100644 --- a/gvanim/action.py +++ b/gvanim/action.py @@ -15,12 +15,11 @@ # You should have received a copy of the GNU General Public License along with # "GraphvizAnim". If not, see . -import animation - class NextStep( object ): def __init__( self, clean = False ): self.clean = clean def __call__( self, steps ): + from . import animation steps.append( animation.Step( None if self.clean else steps[ -1 ] ) ) class AddNode( object ): diff --git a/gvanim/animation.py b/gvanim/animation.py index 690db27..bd5c160 100644 --- a/gvanim/animation.py +++ b/gvanim/animation.py @@ -18,7 +18,7 @@ from email.utils import quote import shlex -import action +from . import action class ParseException( Exception ): pass @@ -113,7 +113,7 @@ def parse( self, lines ): except KeyError: raise ParseException( 'unrecognized command: {}'.format( action ) ) except TypeError: - raise ParseException( 'wrong number of parameters: {}'.format( line.strip() ) ) + raise ParseException( 'wrong number of parameters: {}'.format( line.strip() ) ) return def steps( self ): diff --git a/gvanim/jupyter.py b/gvanim/jupyter.py index e07c57d..5645134 100644 --- a/gvanim/jupyter.py +++ b/gvanim/jupyter.py @@ -22,7 +22,7 @@ from IPython.display import Image import ipywidgets as widgets -from render import render +from .render import render def interactive( animation, size = 320 ): basedir = mkdtemp() diff --git a/gvanim/render.py b/gvanim/render.py index a3ec4d7..69aabcd 100644 --- a/gvanim/render.py +++ b/gvanim/render.py @@ -22,7 +22,7 @@ def _render( params ): path, fmt, size, graph = params with open( path , 'w' ) as out: pipe = Popen( [ 'dot', '-Gsize=1,1!', '-Gdpi={}'.format( size ), '-T', fmt ], stdout = out, stdin = PIPE, stderr = None ) - pipe.communicate( input = graph ) + pipe.communicate( input = graph.encode() ) return path def render( graphs, basename, fmt = 'png', size = 320 ):