diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2014-11-22 17:24:18 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2014-11-22 17:24:18 +0100 |
commit | 4e96b97c84ae5f3d91995fc1f7e926d723df237d (patch) | |
tree | 6cbb8667ebdb39c00a1201ee442ae8fd2fb56775 | |
parent | 6c6e6e6c838028b2cb54266d82ba9cc676838889 (diff) | |
download | scripts-4e96b97c84ae5f3d91995fc1f7e926d723df237d.tar.gz scripts-4e96b97c84ae5f3d91995fc1f7e926d723df237d.zip |
jinja stream api
-rwxr-xr-x | imdb-lookup/imdbinfo.py | 7 |
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): |