App works fine locally but is giving an error on cloud

Hi, I am using the GoogleNews module in Python to build a news tracker. Until a few days back, the app was working fine both on cloud and locally. Now the app only works when hosted locally. It is failing to run on cloud. It is basically failing to populate the dataframe with news articles, please help!


2023-05-21 11:09:38.884 Uncaught app exception
Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/", line 565, in _run_script
    exec(code, module.__dict__)
  File "/app/care_amr/pages/3_📄", line 38, in <module>
    df = df1.loc[:,['media','title','desc','date','link']]
  File "/home/appuser/venv/lib/python3.9/site-packages/pandas/core/", line 1097, in __getitem__
    return self._getitem_tuple(key)
  File "/home/appuser/venv/lib/python3.9/site-packages/pandas/core/", line 1289, in _getitem_tuple
    return self._getitem_tuple_same_dim(tup)
  File "/home/appuser/venv/lib/python3.9/site-packages/pandas/core/", line 955, in _getitem_tuple_same_dim
    retval = getattr(retval,, axis=i)
  File "/home/appuser/venv/lib/python3.9/site-packages/pandas/core/", line 1332, in _getitem_axis
    return self._getitem_iterable(key, axis=axis)
  File "/home/appuser/venv/lib/python3.9/site-packages/pandas/core/", line 1272, in _getitem_iterable
    keyarr, indexer = self._get_listlike_indexer(key, axis)
  File "/home/appuser/venv/lib/python3.9/site-packages/pandas/core/", line 1462, in _get_listlike_indexer
    keyarr, indexer = ax._get_indexer_strict(key, axis_name)
  File "/home/appuser/venv/lib/python3.9/site-packages/pandas/core/indexes/", line 5876, in _get_indexer_strict
    self._raise_if_missing(keyarr, indexer, axis_name)
  File "/home/appuser/venv/lib/python3.9/site-packages/pandas/core/indexes/", line 5935, in _raise_if_missing
    raise KeyError(f"None of [{key}] are in the [{axis_name}]")
KeyError: "None of [Index(['media', 'title', 'desc', 'date', 'link'], dtype='object')] are in the [columns]"

Hi @medhasrikantapuram,

Thank you for sharing your question with the community!

Your post is missing a code snippet and a link to your app’s GitHub repo. Please check out our guidelines on how to post an effective question here and update your post to help the community answer your question.