diff options
author | Ben Sima <ben@bsima.me> | 2018-11-05 14:07:54 -0800 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2018-11-05 14:07:54 -0800 |
commit | 1ec7b6c43bc264798adec51efcfed7060c9d9c83 (patch) | |
tree | 193bffb7121bc4a8d42d120e4e6cf71d0d193b3d /textract | |
parent | 099544381c4f703dc4ec7fb6e785bb262ee02276 (diff) |
Fix python scripts to work with nix
Diffstat (limited to 'textract')
-rwxr-xr-x | textract | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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) |