File tree 1 file changed +5
-6
lines changed
1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 1
1
# -*- coding: UTF-8 -*-
2
+ import codecs
2
3
import os
3
4
import re
4
5
import glob
@@ -143,16 +144,14 @@ def gen_gallery(app, doctree):
143
144
gallery_path = os .path .join (app .builder .srcdir ,
144
145
'_templates' , 'gallery.html' )
145
146
if os .path .exists (gallery_path ):
146
- fh = open (gallery_path , 'r' )
147
- regenerate = fh .read () != content
148
- fh .close ()
147
+ with codecs .open (gallery_path , 'r' , encoding = 'utf-8' ) as fh :
148
+ regenerate = fh .read () != content
149
149
else :
150
150
regenerate = True
151
151
152
152
if regenerate :
153
- fh = open (gallery_path , 'w' )
154
- fh .write (content )
155
- fh .close ()
153
+ with codecs .open (gallery_path , 'w' , encoding = 'utf-8' ) as fh :
154
+ fh .write (content )
156
155
157
156
for key in app .builder .status_iterator (
158
157
iter (thumbnails .keys ()), "generating thumbnails... " ,
You can’t perform that action at this time.
0 commit comments