Skip to content

Commit

Permalink
Python 3.5 does not support open()ing Path objects either (thanks @of…
Browse files Browse the repository at this point in the history
…fby1)

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jul 30, 2017
1 parent 7d32a9a commit 6837ee2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nikola/plugins/command/auto/__init__.py
Expand Up @@ -429,8 +429,8 @@ def handle_file(self, request, filename, from_index=None):
ct, encoding = mimetypes.guess_type(str(filepath))
encoding = encoding or 'utf-8'
if ct == 'text/html' and self.modify_html:
if sys.version_info[0] == 3 and sys.version_info[1] == 4:
# Python 3.4 does not accept pathlib.Path objects in calls to open()
if sys.version_info[0] == 3 and sys.version_info[1] <= 5:
# Python 3.4 and 3.5 do not accept pathlib.Path objects in calls to open()
filepath = str(filepath)
with open(filepath, 'r', encoding=encoding) as fh:
text = fh.read()
Expand Down

0 comments on commit 6837ee2

Please sign in to comment.