From 2142b8d05778e62af2fa7d1d6646067fdf4fa26d Mon Sep 17 00:00:00 2001 From: timv Date: Thu, 13 Dec 2012 13:53:15 -0500 Subject: [PATCH] tweaks to python code. --- bin/prototype.py | 4 ++-- bin/stdlib.py | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bin/prototype.py b/bin/prototype.py index bc45fcd..23c670e 100644 --- a/bin/prototype.py +++ b/bin/prototype.py @@ -100,12 +100,12 @@ class Hypergraph(object): print >> f, '}' - print 'wrote', dot, 'compiling...' +# print 'wrote', dot, 'compiling...' # run graphviz to produce image assert 0 == os.system('(dot -Tsvg %s > %s)' % (dot, svg)), 'graphviz failed.' - print 'created', svg +# print 'created', svg with file(svg) as f: return f.read() diff --git a/bin/stdlib.py b/bin/stdlib.py index 2b4726d..f2f904a 100644 --- a/bin/stdlib.py +++ b/bin/stdlib.py @@ -284,8 +284,12 @@ def go(): with file(dyna + '.chart', 'wb') as f: dump_charts(f) +try: + [dyna] = sys.argv[1:] +except ValueError: + print 'Dyna interpreter:\n\tplease specify a source file.' + sys.exit(1) -[dyna] = sys.argv[1:] cmd = """ghc -isrc Dyna.Backend.Python -e 'processFile "%s"' """ % dyna assert 0 == os.system(cmd), 'command failed:\n\t' + cmd @@ -360,7 +364,4 @@ for _fn in chart: except: pass -#def phrase(A,I,K): -# return chart['phrase/3'] - from IPython import embed; embed() -- 2.50.1