X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/967eed676fc83d15b26149047f353ac61faa8217..8885fd14f5f040eb3aa69f1d705856f99a1fa572:/src/lesmianator/management/commands/lesmianator.py diff --git a/src/lesmianator/management/commands/lesmianator.py b/src/lesmianator/management/commands/lesmianator.py index bcad60189..7b7a5afc3 100644 --- a/src/lesmianator/management/commands/lesmianator.py +++ b/src/lesmianator/management/commands/lesmianator.py @@ -1,5 +1,5 @@ -# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Wolne Lektury. See NOTICE for more information. # import re from pickle import dump @@ -75,7 +75,7 @@ class Command(BaseCommand): processed += 1 last_word = '' - text = str(m.group(1), 'utf-8').lower() + text = m.group(1).lower() for letter in text: mydict = lesmianator.setdefault(last_word, {}) mydict.setdefault(letter, 0) @@ -91,12 +91,11 @@ class Command(BaseCommand): return try: - dump(lesmianator, open(path, 'w')) + dump(lesmianator, open(path, 'wb')) except IOError: print(self.style.ERROR("Couldn't write to $s" % path)) return - dump(lesmianator, open(path, 'w')) if verbose >= 1: print("%d processed, %d skipped" % (processed, skipped)) print("Results dumped to %s" % path)