Skip to content

Commit

Permalink
Fix model installation failure caused by coding problems under windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nepeplwu committed Dec 1, 2020
1 parent 3b5d7f7 commit e5cb617
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions paddlehub/module/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import ast
import builtins
import codecs
import inspect
import os
import re
Expand Down Expand Up @@ -107,7 +108,7 @@ def get_py_requirements(cls) -> List[str]:
req_file = os.path.join(directory, 'requirements.txt')
if not os.path.exists(req_file):
return []
with open(req_file, 'r') as file:
with codecs.open(req_file, 'r', encoding='utf8') as file:
return file.read().split('\n')

@property
Expand Down Expand Up @@ -229,7 +230,7 @@ def load_module_info(cls, directory: str) -> EasyDict:

# If is ModuleV2
module_file = os.path.join(directory, 'module.py')
with open(module_file, 'r') as file:
with codecs.open(module_file, 'r', encoding='utf8') as file:
pycode = file.read()
ast_module = ast.parse(pycode)

Expand Down

0 comments on commit e5cb617

Please sign in to comment.