File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,10 @@ def generate_example_rst(app):
38
38
continue
39
39
40
40
fullpath = os .path .join (root ,fname )
41
- contents = io .open (fullpath , encoding = 'utf8' ).read ()
41
+ if sys .version_info [0 ] >= 3 :
42
+ contents = io .open (fullpath , encoding = 'utf8' ).read ()
43
+ else :
44
+ contents = io .open (fullpath ).read ()
42
45
# indent
43
46
relpath = os .path .split (root )[- 1 ]
44
47
datad .setdefault (relpath , []).append ((fullpath , fname , contents ))
@@ -130,7 +133,10 @@ def generate_example_rst(app):
130
133
if not out_of_date (fullpath , outrstfile ):
131
134
continue
132
135
133
- fh = io .open (outrstfile , 'w' , encoding = 'utf8' )
136
+ if sys .version_info [0 ] >= 3 :
137
+ fh = io .open (outrstfile , 'w' , encoding = 'utf8' )
138
+ else :
139
+ fh = io .open (outrstfile , 'w' )
134
140
fh .write ('.. _%s-%s:\n \n ' % (subdir , basename ))
135
141
title = '%s example code: %s' % (subdir , fname )
136
142
#title = '<img src=%s> %s example code: %s'%(thumbfile, subdir, fname)
You can’t perform that action at this time.
0 commit comments