summaryrefslogtreecommitdiff
path: root/imdb-lookup
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2014-11-22 17:24:18 +0100
committerYves Fischer <yvesf-git@xapek.org>2014-11-22 17:24:18 +0100
commit4e96b97c84ae5f3d91995fc1f7e926d723df237d (patch)
tree6cbb8667ebdb39c00a1201ee442ae8fd2fb56775 /imdb-lookup
parent6c6e6e6c838028b2cb54266d82ba9cc676838889 (diff)
downloadscripts-4e96b97c84ae5f3d91995fc1f7e926d723df237d.tar.gz
scripts-4e96b97c84ae5f3d91995fc1f7e926d723df237d.zip
jinja stream api
Diffstat (limited to 'imdb-lookup')
-rwxr-xr-ximdb-lookup/imdbinfo.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/imdb-lookup/imdbinfo.py b/imdb-lookup/imdbinfo.py
index 1e60fa7..5a4c7fe 100755
--- a/imdb-lookup/imdbinfo.py
+++ b/imdb-lookup/imdbinfo.py
@@ -179,8 +179,11 @@ def do_index(args, imdb_ids):
'title' : 'Movie overview',
}
assert not os.path.exists("index.html"), "index.html already exists"
- output = template.render(mapping).encode("utf-8")
- open("index.html", "wb").write(output)
+ stream = template.generate(mapping)
+ outfile = open("index.html", "wb")
+ for output in stream:
+ output = output.encode("utf-8")
+ outfile.write(output)
class HelpAction(argparse._HelpAction):
def __call__(self, parser, namespace, values, option_string=None):