Просмотр исходного кода

fix: UnicodeDecodeError in windows

wangweimin 4 лет назад
Родитель
Сommit
1d321a9b83
2 измененных файлов с 2 добавлено и 2 удалено
  1. 1 1
      pywebio/platform/utils.py
  2. 1 1
      setup.py

+ 1 - 1
pywebio/platform/utils.py

@@ -16,7 +16,7 @@ DEFAULT_CDN = "https://cdn.jsdelivr.net/gh/wang0618/PyWebIO-assets@v{version}/"
 AppMeta = namedtuple('App', 'title description')
 
 _here_dir = path.dirname(path.abspath(__file__))
-_index_page_tpl = template.Template(open(path.join(_here_dir, 'tpl', 'index.html')).read())
+_index_page_tpl = template.Template(open(path.join(_here_dir, 'tpl', 'index.html'), encoding='utf8').read())
 
 
 def render_page(app, protocol, cdn):

+ 1 - 1
setup.py

@@ -6,7 +6,7 @@ from setuptools import setup
 here = os.path.abspath(os.path.dirname(__file__))
 
 about = {}
-with open(os.path.join(here, 'pywebio', '__version__.py')) as f:
+with open(os.path.join(here, 'pywebio', '__version__.py'), encoding='utf8') as f:
     exec(f.read(), about)
 
 with open('README.md', encoding='utf8') as f: