From 8383e6ebb33e41fc50e4e235974b4918b6f34981 Mon Sep 17 00:00:00 2001 From: zevav Date: Wed, 20 Feb 2019 12:31:31 -0500 Subject: [PATCH] fixing writing ot file --- setup.py | 2 +- tatt/transcribe.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 5207343..c0649d0 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ with open('README.md') as file: setup( name="tatt", - version="0.951", + version="0.953", py_modules=['tatt'], url='https://github.com/zevaverbach/tatt', install_requires=[ diff --git a/tatt/transcribe.py b/tatt/transcribe.py index 3dfa9de..f8462ec 100644 --- a/tatt/transcribe.py +++ b/tatt/transcribe.py @@ -25,11 +25,16 @@ def get(name, save): except exceptions.NotAvailable as e: raise click.ClickException(str(e)) - filepath = None + file = None if save: - filepath = f'{name}.json' + filepath = f'{name}.json', 'w' + file = open(filepath) - click.echo(transcript, file=filepath) + click.echo(transcript, file=file) + + if file: + click.echo(f'Saved transcript to {filepath}.') + file.close()