Add exception interpreters for Python ModuleNotFoundError and multiple inheritance TypeError - #9643
Open
jhonabreul wants to merge 3 commits into
Open
Conversation
…e only for local custom libraries
jhonabreul
marked this pull request as ready for review
July 29, 2026 15:01
…mmending equivalent Python packages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Two common Python algorithm initialization failures currently surface through the generic
PythonExceptionInterpreterwith no guidance on how to fix them:Cause: importing a C# namespace whose assembly has not been loaded into the CLR raises
ModuleNotFoundError, and defining a Python class with a managed class plus another base raisesTypeError— neither had a specialized interpreter.The fix:
ModuleNotFoundPythonExceptionInterpretermatchesPythonExceptions whose Python type isModuleNotFoundErrorand appends a short hint: install the package if it is a Python one; importing .NET assemblies is not supported, so use an equivalent Python package instead.MultipleInheritancePythonExceptionInterpretermatches thecannot use multiple inheritance with managed classesTypeErrorand recommends keeping the C# class as the only base, moving the other bases' members into helpers used via composition.Order = 0, taking precedence over the genericPythonExceptionInterpreter, and keep the parsed Python stack trace so the failing line is still shown.Related Issue
N/A
Motivation and Context
Actionable one-line hints let users (and LLM assistants reading the error) fix these failures without external help, while keeping the error message short.
Requires Documentation Change
No.
How Has This Been Tested?
ModuleNotFoundPythonExceptionInterpreterTestsandMultipleInheritancePythonExceptionInterpreterTests:CanInterprettype matrix,Interpretmismatch behavior, and interpreted-message content throughStackExceptionInterpreter.CreateFromAssemblies.module_not_found/multiple_inheritancetrigger methods inTest_PythonExceptionInterpreter.py.QuantConnect.Tests.Common.Exceptionssuite: 125 passed, 0 failed.AlgorithmPythonWrapperconstruction and full Launcher backtest runs of reproduction algorithms for both failure modes.Types of changes
Checklist:
bug-<issue#>-<description>orfeature-<issue#>-<description>