Unable to retrieve data properly while app is deployed on streamlit

My app is deployed on the community cloud and I receive an error while trying to retrieve data. It works fine locally. Also since yfinance is broken and not working properly, I am using beautifulsoup. Any other suggestions to build a valuation tool using APIs are highly welcome. Thanks in advance

Project Link: GitHub - anant1990/EquityAnalyzer: A tool to analyze stocks

Error message is below:

2023-11-22 10:17:00.929 Uncaught app exception
Traceback (most recent call last):
  File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 534, in _run_script
    exec(code, module.__dict__)
  File "/mount/src/equityanalyzer/proto_v1.py", line 202, in <module>
    eps_val = eps_valuation(ticker, ttm_eps, growth_rate, growth_decline_rate)
  File "/mount/src/equityanalyzer/proto_v1.py", line 77, in eps_valuation
    final_eps_val = final_eps_val * (get_forward_pe_from_website(ticker))
TypeError: unsupported operand type(s) for *: 'float' and 'NoneType'

Python version: 3.11.6
Streamlit version: 1.28.0

Actually it happens while trying to do a multiplication.

final_eps_val = final_eps_val * (get_forward_pe_from_website(ticker))

What do you want final_eps_val to be when get_forward_pe_from_website returns None?

Use a service officially providing an API.

1 Like

Thanks for that. I would say ‘Data unavailable’ and ask the user to input again. What I don’t understand is why I’m not getting a value in this case and getting none as I do get the value fine on localhost and the problem is when I’m deploying it on the cloud

Then you just need to write the code that does that.

Who knows? As a first step, the Response and / or Exception objects in get_forward_pe_from_website may have relevant info on why you are not getting a number.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.