Skip to content

Commit

Permalink
Add handling of TypeError case to is_native (plasma-umass#588)
Browse files Browse the repository at this point in the history
This should address plasma-umass#587 which has more information, but basically the check for native fails on at least my system because package.__file__ exists, but is None, so os.path.dirname() returns a TypeError.
  • Loading branch information
ahaberlach authored Mar 30, 2023
1 parent 82665a5 commit 9bc73df
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scalene/scalene_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def is_native(package_name: str) -> bool:
except AttributeError:
# No __file__, meaning it's built-in. Let's call it native.
result = True
except TypeError:
# __file__ is there, but empty (os.path.dirname() returns TypeError). Let's call it native.
result = True
except ModuleNotFoundError:
# This module is not installed; fail gracefully.
result = False
Expand Down

0 comments on commit 9bc73df

Please sign in to comment.