Skip to content
Merged
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
12 changes: 10 additions & 2 deletions scapy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,10 +631,18 @@ def load(self, extension: str):
try:
import importlib.metadata
except ImportError:
raise ImportError("Cannot import importlib.metadata ! Upgrade Python.")
log_loading.warning(
"'%s' not loaded. "
"Scapy extensions require at least Python 3.8+ !" % extension
)
return

# Get extension distribution
distr = importlib.metadata.distribution(extension)
try:
distr = importlib.metadata.distribution(extension)
except importlib.metadata.PackageNotFoundError:
log_loading.warning("The extension '%s' was not found !" % extension)
return

# Check the classifiers
if distr.metadata.get('License-Expression', None) not in self.GPLV2_LICENCES:
Expand Down
Loading