| skipped 28 lines |
29 | 29 | | # (all optional futures for 2.7) |
30 | 30 | | from __future__ import print_function, absolute_import, division, unicode_literals |
31 | 31 | | |
32 | | - | __version__ = "0.17.7" |
| 32 | + | __version__ = "0.17.8" |
33 | 33 | | __ordering_version__ = b"0.6.4" # must be updated whenever password ordering changes |
34 | 34 | | |
35 | 35 | | import sys, argparse, itertools, string, re, multiprocessing, signal, os, cPickle, gc, \ |
| skipped 2778 lines |
2814 | 2814 | | file = io.open(filename, mode, encoding="utf_8_sig", errors=decoding_errors) |
2815 | 2815 | | else: |
2816 | 2816 | | file = open(filename, mode) |
| 2817 | + | # |
| 2818 | + | if "b" not in mode: |
| 2819 | + | if file.read(5) == br"{\rtf": |
| 2820 | + | error_exit(filename, "must be a plain text file (.txt), not a Rich Text File (.rtf)") |
| 2821 | + | file.seek(0) |
| 2822 | + | # |
2817 | 2823 | | return MakePeekable(file) if make_peekable else file |
2818 | 2824 | | |
2819 | 2825 | | |
| skipped 2766 lines |