ranaroussi / yfinance

Download market data from Yahoo! Finance's API
https://aroussi.com/post/python-yahoo-finance
Apache License 2.0
14.89k stars 2.44k forks source link

Fix malformed f-string in release `0.2.45` #2094

Closed FX196 closed 1 month ago

FX196 commented 1 month ago

Quick fix for issue https://github.com/ranaroussi/yfinance/issues/2093 This broke yfinance for me after I automatically upgraded to the latest release.

Existing tests should suffice. Directly targeting main because the release is broken

fled-dev commented 1 month ago

Just tried it on my system (macOS 15.1 / Python 3.11.9) and it works like a charm. Thanks for putting in the effort to address this issue.

DavidVilem commented 1 month ago

Hello good morning.

I am testing from databricks and it generates the same error:

Syntax error: string f: mismatch '(' (screener.py, line 101)

vwbusguy commented 1 month ago

I just tested against an image environment that failed tests from this error and this patch works:

pip install --force  git+https://github.com/FX196/yfinance@patch-1
python -c 'import yfinance'

Without the patch on the same image environment:

python -c 'import yfinance'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/conda/lib/python3.11/site-packages/yfinance/__init__.py", line 30, in <module>
    from .screener.screener import Screener
  File "/opt/conda/lib/python3.11/site-packages/yfinance/screener/__init__.py", line 1, in <module>
    from .screener import Screener
  File "/opt/conda/lib/python3.11/site-packages/yfinance/screener/screener.py", line 101
    logger.error(f"Failed to get screener data for '{self._body.get('query', "query not set")}' reason: {e}")
                                                                              ^^^^^
SyntaxError: f-string: unmatched '('