Skip to content

Commit

Permalink
fix: Add missing importlib.util import
Browse files Browse the repository at this point in the history
* Without first importing importlib.util an AttributeError will be raised

```
Traceback (most recent call last):
  File "/madanalysis5/./bin/ma5", line 51, in <module>
    if not importlib.util.find_spec("six"):
           ^^^^^^^^^^^^^^
AttributeError: module 'importlib' has no attribute 'util'
```
  • Loading branch information
matthewfeickert committed Dec 3, 2024
1 parent 3900ec9 commit e42a7fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/ma5
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This is the main executable, a simple frontend to set up the PYTHONPATH
and call immediately the command line interface scripts
"""

import importlib
from importlib import util
import os
import sys

Expand All @@ -48,7 +48,7 @@ if sys.version_info[0] != 3 or sys.version_info[1] <= 6:
)

# Checking that the 'six' package is present
if not importlib.util.find_spec("six"):
if not util.find_spec("six"):
sys.exit(
'The python "six" module is not found on your system and it is required for MadAnalysis 5 for '
+ "a question of Python 2/3 compatibility. Please install it with the following command:\n"
Expand Down
3 changes: 3 additions & 0 deletions doc/releases/changelog-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

## Bug fixes

* Add missing `importlib.util` import.
([#278](https://github.com/MadAnalysis/madanalysis5/pull/278))

## Contributors

This release contains contributions from (in alphabetical order):

0 comments on commit e42a7fd

Please sign in to comment.