Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Conversion Error Message for Python #8042

Open
4 tasks done
AlexCatarino opened this issue May 20, 2024 · 2 comments
Open
4 tasks done

Improve Conversion Error Message for Python #8042

AlexCatarino opened this issue May 20, 2024 · 2 comments
Assignees
Labels

Comments

@AlexCatarino
Copy link
Member

Expected Behavior

The error message informs the developer why the conversion failed and the expected type.

Actual Behavior

If a method returns an unexpected type, the error message is not very helpful.

Potential Solution

N/A

Reproducing the Problem

class AdaptableSkyBlueHornet(QCAlgorithm):
    def initialize(self):
        self.add_equity("SPY")
        self.add_alpha(MyAlpha())

class MyAlpha(AlphaModel):
    def update(self, _, slice):
        return

The error message is Runtime Error: 'NoneType' object is not iterable
The problem is that alpha should return a list (iterable) of Insight. Calling return without an object in Python is the same as return None.

Checklist

  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
  • I have provided detailed steps to reproduce the issue
@jaredbroad
Copy link
Member

The first issue to fix is a better stack trace for debugging all future versions of this error.

@Martin-Molinero
Copy link
Member

Martin-Molinero commented Jun 7, 2024

  • Continue to spread out the usage of our BasePythonWrapper helper class, this class can catch failures on properties/method/etc calls adding in more information of what is expected where did the issue happen
    - TODO add classes that required PythonWrapper
image
  • Detect if the failure is while running python code, method/property itself
  • Or like in the case of this issue, while converting the output returned to the expected type
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants