From 1ec7b6c43bc264798adec51efcfed7060c9d9c83 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 5 Nov 2018 14:07:54 -0800 Subject: Fix python scripts to work with nix --- textract | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'textract') diff --git a/textract b/textract index 996393f..f80be36 100755 --- a/textract +++ b/textract @@ -1,4 +1,5 @@ -#!/usr/bin/env python3.5 +#! /usr/bin/env nix-shell +#! nix-shell -i python -p "python3.withPackages(p: [p.requests p.pyreadability])" import argparse from readability import Document @@ -9,11 +10,12 @@ cli = argparse.ArgumentParser('read a url') cli.add_argument('url', type=str) if __name__ == '__main__': + args = cli.parse_args() try: - args = cli.parse_args() resp = requests.get(args.url) doc = Document(resp.text) sys.stdout.write(doc.summary()) sys.exit(0) except: + print("Could not fetch document.") sys.exit(1) -- cgit v1.2.3