Skip to content

Commit

Permalink
Catch read-only exceptions during cache write
Browse files Browse the repository at this point in the history
  • Loading branch information
ValueRaider committed Oct 23, 2022
1 parent 42e6d08 commit ef12c8b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion yfinance/base.py
Expand Up @@ -339,7 +339,11 @@ def _get_ticker_tz(self):
if tkr_tz is None:
tkr_tz = self.info["exchangeTimezoneName"]
# info fetch is relatively slow so cache timezone
utils.cache_store_tkr_tz(self.ticker, tkr_tz)
try:
utils.cache_store_tkr_tz(self.ticker, tkr_tz)
except PermissionError:
# System probably read-only, so cannot cache
pass

self._tz = tkr_tz
return tkr_tz
Expand Down

0 comments on commit ef12c8b

Please sign in to comment.