Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af6b3ff

Browse files
committed
Fix update_downloads.py for Unicode
1 parent 2f06519 commit af6b3ff

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

update_downloads.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import base64
1212
import getpass
13+
import io
1314
import os
1415
import socket
1516
import sys
@@ -85,10 +86,10 @@ def get_file_listings(hostname, username, password, hostkey, versions):
8586

8687
def generate_download_page(files):
8788
from jinja2 import Template
88-
with open("downloads.tpl.html", "r") as fd:
89+
with io.open("downloads.tpl.html", "r", encoding='utf-8') as fd:
8990
t = Template(fd.read())
9091
stream = t.stream(files=files)
91-
with open("downloads.html", "wb") as fd:
92+
with io.open("downloads.html", "w", encoding='utf-8') as fd:
9293
stream.dump(fd)
9394

9495

0 commit comments

Comments
 (0)