Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Commit

Permalink
Handle OSError on local module reqs analyzer (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
mike0sv authored Oct 27, 2022
1 parent 601be82 commit 2846cc6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mlem/utils/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,11 @@ def get_module_as_requirement(

def get_local_module_reqs(mod) -> List[ModuleType]:
"""Parses module AST to find all import statements"""
tree = ast.parse(inspect.getsource(mod))
try:
tree = ast.parse(inspect.getsource(mod))
except OSError:
logger.debug("Failed to get source of %s", str(mod))
return []
imports: List[Tuple[str, Optional[str]]] = []
for statement in tree.body:
if isinstance(statement, ast.Import):
Expand Down

0 comments on commit 2846cc6

Please sign in to comment.