@@ -80,8 +80,8 @@ def _execute(self, options, args):
80
80
if not options ['yes' ]:
81
81
yesno = utils .ask_yesno ("Proceed with metadata upgrade?" )
82
82
if options ['yes' ] or yesno :
83
- no_converted = 0
84
- no_converted_partial = 0
83
+ number_converted = 0
84
+ number_converted_partial = 0
85
85
for post in flagged :
86
86
converted = False
87
87
fully_converted = True
@@ -102,6 +102,10 @@ def _execute(self, options, args):
102
102
continue
103
103
104
104
# Read metadata and text from post file
105
+ if not os .path .exists (fname ):
106
+ L .debug ("File {0} does not exist, skipping." .format (fname ))
107
+ continue
108
+
105
109
with io .open (fname , "r" , encoding = "utf-8-sig" ) as meta_file :
106
110
source_text = meta_file .read ()
107
111
if not is_two_file :
@@ -164,18 +168,18 @@ def _execute(self, options, args):
164
168
comment_wrap = (post .compiler .name != 'rest' ), site = self .site )
165
169
final_str = meta_str if is_two_file else (meta_str + content_str )
166
170
167
- with io .open (fname , "w" , encoding = "utf-8-sig " ) as meta_file :
171
+ with io .open (fname , "w" , encoding = "utf-8" ) as meta_file :
168
172
meta_file .write (final_str )
169
173
converted = True
170
174
171
175
if converted :
172
176
if fully_converted :
173
- no_converted += 1
177
+ number_converted += 1
174
178
else :
175
- no_converted_partial += 1
179
+ number_converted_partial += 1
176
180
177
181
L .info ('{0} out of {2} posts upgraded; {1} only converted partially '
178
- '(see above output).' .format (no_converted + no_converted_partial , no_converted_partial , len (flagged )))
182
+ '(see above output).' .format (number_converted + number_converted_partial , number_converted_partial , len (flagged )))
179
183
else :
180
184
L .info ('Metadata not upgraded.' )
181
185
else :
0 commit comments