Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pytype/tools/analyze_project/pytype_runner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Use pytype to analyze and infer types for an entire project."""

import importlib
import collections
import itertools
import logging
Expand Down Expand Up @@ -46,7 +47,8 @@ def _get_executable(binary, module=None):
path_utils.abspath(path_utils.dirname(custom_bin)),
'pytype-single')
])
if sys.executable is not None:
importable = importlib.util.find_spec(module or binary)
if sys.executable is not None and importable:
return [sys.executable, '-m', module or binary]
else:
return [binary]
Expand Down