Open harryho71 opened 1 year ago
Try GitHub branch hotfix/sql-db-error
- instructions #1080.
Try GitHub branch
hotfix/sql-db-error
- instructions #1080.
It works. Thanks a lot!
Since today, the DatabaseError comes up again, but with peewee.
Error message in file. error message.txt
Re-patching will take time as the caching has completely changed since the previous patch. Quickest fix should be deleting the database: https://github.com/ranaroussi/yfinance#persistent-cache-store
Re-patching will take time as the caching has completely changed since the previous patch. Quickest fix should be deleting the database: https://github.com/ranaroussi/yfinance#persistent-cache-store
First, I deleted the database in C:\Users\
After searching for other locations, I found __C:\Users\
Problem
I cannot download historical stock data with yfinance
Simple code that reproduces your problem
data = yf.download("SPY", start="2017-01-01", end="2017-04-30")
Full debug logging enabled output
DEBUG Entering download() DEBUG Disabling multithreading because DEBUG logging enabled DEBUG Entering history() ERROR
1 Failed download: ERROR ['SPY']: DatabaseError('database disk image is malformed') DEBUG ['SPY']: Traceback (most recent call last): File "C:\Users\harry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\yfinance\multi.py", line 273, in _download_one data = Ticker(ticker, session=session).history( File "C:\Users\harry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\yfinance\utils.py", line 105, in wrapper result = func(*args, **kwargs) File "C:\Users\harry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\yfinance\base.py", line 153, in history tz = self._get_ticker_tz(proxy, timeout) File "C:\Users\harry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\yfinance\base.py", line 1409, in _get_ticker_tz cache = utils.get_tz_cache() File "C:\Users\harry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\yfinance\utils.py", line 1045, in get_tz_cache _tz_cache = _TzCache() File "C:\Users\harry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\yfinance\utils.py", line 958, in init self._tz_db = _KVStore(_os.path.join(self._db_dir, "tkr-tz.db")) File "C:\Users\harry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\yfinance\utils.py", line 900, in init self.conn.execute('pragma journal_mode=wal') sqlite3.DatabaseError: database disk image is malformed
DEBUG Exiting download()
Version
yfinance
version: 0.2.21