Hi there,
While initializing an empty listin Python with:
# Initialize dictionaries to hold stock data
self.universe = []
self.selected_stocks = []
self.stock_data = {}
I got following error:
During the algorithm initialization, the following exception has occurred: error return without exception set at Initialize self.universe = [] ^^^^^^^^^^^^^ in main.py: line 16 error return without exception set
I do not see any error in the code.
If somebody knows. Thanks
SL
Mia Alissi
The error message you're seeing is not typically associated with the code snippet you've provided. Initializing lists and dictionaries in Python as you've done should not cause any issues. The error message "error return without exception set" is usually associated with some sort of Python C extension, not with basic Python data structures.
However, in QuantConnect,
self.Universe
is a reserved word and is a method in QCAlgorithm. If you're trying to assign a list toself.Universe
, it might cause an error. You should use a different name for your list. For example:If the error persists, it might be related to other parts of your code not shown in the snippet. Please check the rest of your code for potential issues.
Source
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Mia Alissi
The error message you're seeing is not typically associated with the code snippet you've provided. Initializing lists and dictionaries in Python as you've done should not cause any issues. The error message "error return without exception set" is usually associated with some sort of Python C extension, not with basic Python data structures.
However, in QuantConnect,
self.Universe
is a reserved word and is a method in QCAlgorithm. If you're trying to assign a list toself.Universe
, it might cause an error. You should use a different name for your list. For example:If the error persists, it might be related to other parts of your code not shown in the snippet. Please check the rest of your code for potential issues.
Source
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Sebastien M. Laignel
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!