diff --git a/mypy/stubgen.py b/mypy/stubgen.py old mode 100644 new mode 100755 index e028575eb249..95f06e587ce2 --- a/mypy/stubgen.py +++ b/mypy/stubgen.py @@ -194,8 +194,8 @@ def generate_stub(path: str, pyversion: Tuple[int, int] = defaults.PYTHON3_VERSION, include_private: bool = False ) -> None: - with open(path, 'rb') as f: - source = f.read() + + source, _ = mypy.build.read_with_python_encoding(path, pyversion) options = MypyOptions() options.python_version = pyversion try: