diff --git a/qiskit/circuit/classicalfunction/boolean_expression.py b/qiskit/circuit/classicalfunction/boolean_expression.py index 1ed820058b18..0f4a53494af4 100644 --- a/qiskit/circuit/classicalfunction/boolean_expression.py +++ b/qiskit/circuit/classicalfunction/boolean_expression.py @@ -110,6 +110,7 @@ def from_dimacs_file(cls, filename: str): Raises: FileNotFoundError: If filename is not found. """ + HAS_TWEEDLEDUM.require_now("BooleanExpression") from tweedledum import BoolFunction # pylint: disable=import-error diff --git a/releasenotes/notes/fix-exception-from_dimacs_file-b9338f3c913a9bff.yaml b/releasenotes/notes/fix-exception-from_dimacs_file-b9338f3c913a9bff.yaml new file mode 100644 index 000000000000..b7f2d34d5cda --- /dev/null +++ b/releasenotes/notes/fix-exception-from_dimacs_file-b9338f3c913a9bff.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fixed an issue with the :meth:`.BooleanExpression.from_dimacs_file` + constructor method where the exception type raised when tweedledum wasn't + installed was not the expected :class:`~.MissingOptionalLibrary`. + Fixed `#10079 `__