@@ -191,6 +191,16 @@ def makesfx(tar_src, ver, ts):
191
191
# skip 0
192
192
193
193
194
+ def u8 (gen ):
195
+ try :
196
+ for s in gen :
197
+ yield s .decode ("utf-8" , "ignore" )
198
+ except :
199
+ yield s
200
+ for s in gen :
201
+ yield s
202
+
203
+
194
204
def get_py_win (ret ):
195
205
tops = []
196
206
p = str (os .getenv ("LocalAppdata" ))
@@ -216,11 +226,11 @@ def get_py_win(ret):
216
226
# $WIRESHARK_SLOGAN
217
227
for top in tops :
218
228
try :
219
- for name1 in sorted (os .listdir (top ), reverse = True ):
229
+ for name1 in u8 ( sorted (os .listdir (top ), reverse = True ) ):
220
230
if name1 .lower ().startswith ("python" ):
221
231
path1 = os .path .join (top , name1 )
222
232
try :
223
- for name2 in os .listdir (path1 ):
233
+ for name2 in u8 ( os .listdir (path1 ) ):
224
234
if name2 .lower () == "python.exe" :
225
235
path2 = os .path .join (path1 , name2 )
226
236
ret [path2 .lower ()] = path2
@@ -237,7 +247,7 @@ def get_py_nix(ret):
237
247
next
238
248
239
249
try :
240
- for fn in os .listdir (bindir ):
250
+ for fn in u8 ( os .listdir (bindir ) ):
241
251
if ptn .match (fn ):
242
252
fn = os .path .join (bindir , fn )
243
253
ret [fn .lower ()] = fn
@@ -352,7 +362,7 @@ def unpack():
352
362
msg ("reloc fail," , mine )
353
363
return mine
354
364
355
- for fn in os .listdir (top ):
365
+ for fn in u8 ( os .listdir (top ) ):
356
366
if fn .startswith (name ) and fn not in [name , withpid ]:
357
367
try :
358
368
old = os .path .join (top , fn )
0 commit comments