When fetching historical data using yfinance for the ticker symbol MRO.L, an error occurs: "cannot access local variable 'df_orig' where it is not associated with a value". This error seems to originate from the history.py file in the yfinance library and prevents successful data retrieval.
Observations:
The error occurs exclusively for the ticker symbol MRO.L.
Other ticker symbols do not exhibit this error.
The error indicates that the variable df_orig in history.py is being used before it has been assigned a value.
Steps to Reproduce:
Use yfinance to fetch historical data for MRO.L:
This error happens only by this ticker, more than 500 are ok. Also no problems without repair=True.
Nachricht = cannot access local variable 'df_orig' where it is not associated with a value
Quelle = D:\Dokumente\Tradeview\Jupyter\PriceUpdate\dbclearing.py
Stapelüberwachung:
File "D:\Dokumente\Tradeview\Jupyter\PriceUpdate\dbclearing.py", line 67, in analyse_repairs
stock_info = stock.history(period='max', actions=False, auto_adjust=False, repair=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Dokumente\Tradeview\Jupyter\PriceUpdate\PriceUpdate.py", line 37, in (Current frame)
dbc.analyse_repairs(stock_id, symbol)
UnboundLocalError: cannot access local variable 'df_orig' where it is not associated with a value
Describe bug
When fetching historical data using yfinance for the ticker symbol MRO.L, an error occurs: "cannot access local variable 'df_orig' where it is not associated with a value". This error seems to originate from the history.py file in the yfinance library and prevents successful data retrieval.
Observations: The error occurs exclusively for the ticker symbol MRO.L. Other ticker symbols do not exhibit this error. The error indicates that the variable df_orig in history.py is being used before it has been assigned a value.
Steps to Reproduce:
This error happens only by this ticker, more than 500 are ok. Also no problems without repair=True.
Simple code that reproduces your problem
stock = yf.Ticker("MRO.L") stock_info = stock.history(period='max', actions=False, auto_adjust=False, repair=True)
Debug log
Nachricht = cannot access local variable 'df_orig' where it is not associated with a value Quelle = D:\Dokumente\Tradeview\Jupyter\PriceUpdate\dbclearing.py Stapelüberwachung: File "D:\Dokumente\Tradeview\Jupyter\PriceUpdate\dbclearing.py", line 67, in analyse_repairs stock_info = stock.history(period='max', actions=False, auto_adjust=False, repair=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Dokumente\Tradeview\Jupyter\PriceUpdate\PriceUpdate.py", line 37, in (Current frame)
dbc.analyse_repairs(stock_id, symbol)
UnboundLocalError: cannot access local variable 'df_orig' where it is not associated with a value
Bad data proof
No response
yfinance
version0.24
Python version
3.12
Operating system
Windows Home 11