Skip to content
Permalink
Browse files

Python 3.5 does not support open()ing Path objects either (thanks @of…

…fby1)

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jul 30, 2017
1 parent 7d32a9a commit 6837ee2e9e31a365c1500569cc9412db14bd4404
Showing with 2 additions and 2 deletions.
  1. +2 −2 nikola/plugins/command/auto/__init__.py
@@ -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()

0 comments on commit 6837ee2

Please sign in to comment.