# KeyError: 'selector' while deploying streamlit python app on Heroku

**URL:** <https://discuss.streamlit.io/t/keyerror-selector-while-deploying-streamlit-python-app-on-heroku/4663>\
**Category:** Deployment\
**Tags:** heroku\
**Created:** [July 31, 2020, 7:40pm UTC](https://discuss.streamlit.io/t/keyerror-selector-while-deploying-streamlit-python-app-on-heroku/4663 "2020-07-31T19:40:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shiv111](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/shiv111/32/2689_2.png) [@shiv111](https://discuss.streamlit.io/u/shiv111)\
**Post date:** [July 31, 2020, 7:40pm UTC](https://discuss.streamlit.io/t/keyerror-selector-while-deploying-streamlit-python-app-on-heroku/4663/1 "2020-07-31T19:40:28Z")

</div>

Hi guys,

I have deployed my python app via streamlit on heroku. The only issue I face is that when I try to display a styled dataframe with background gradient on heroku it throws me the following error:

```auto
    KeyError: 'selector'
Traceback:
File "/app/.heroku/python/lib/python3.6/site-packages/streamlit/ScriptRunner.py", line 319, in _run_script
    exec(code, module. __dict__ )
File "/app/test.py", line 243, in <module>
    print(st.dataframe(etf.format_world_data(world_indices(), usd=usd)[1]))
File "/app/.heroku/python/lib/python3.6/site-packages/streamlit/DeltaGenerator.py", line 921, in dataframe
    set_data_frame, "dataframe", element_width=width, element_height=height
File "/app/.heroku/python/lib/python3.6/site-packages/streamlit/DeltaGenerator.py", line 426, in _enqueue_new_element_delta
    rv = marshall_element(msg.delta.new_element)
File "/app/.heroku/python/lib/python3.6/site-packages/streamlit/DeltaGenerator.py", line 918, in set_data_frame
    data_frame_proto.marshall_data_frame(data, delta.data_frame)
File "/app/.heroku/python/lib/python3.6/site-packages/streamlit/elements/data_frame_proto.py", line 54, in marshall_data_frame
    _marshall_styles(proto_df.style, df, styler)
File "/app/.heroku/python/lib/python3.6/site-packages/streamlit/elements/data_frame_proto.py", line 74, in _marshall_styles
    css_styles = _get_css_styles(translated_style)
File "/app/.heroku/python/lib/python3.6/site-packages/streamlit/elements/data_frame_proto.py", line 116, in _get_css_styles
    cell_selector = cell_style["selector"] # a string of the form 'row0_col0'

```

The code works fine on my local machine and displays the styled dataframe perfectly. I have tried using st.write, st.dataframe and st.table as well, but still the error when deployed on heroku. What can I do to rectify this?

---

<div class="post-metadata">

**Author:** ![randyzwitch](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/randyzwitch/32/58772_2.png) [@randyzwitch](https://discuss.streamlit.io/u/randyzwitch)\
**Post date:** [July 31, 2020, 9:00pm UTC](https://discuss.streamlit.io/t/keyerror-selector-while-deploying-streamlit-python-app-on-heroku/4663/2 "2020-07-31T21:00:20Z")

</div>

This question is a duplicate to this SO, where the answer was accepted.

> <https://stackoverflow.com/questions/63198480/keyerror-selector-while-deploying-streamlit-python-app-on-heroku/63198786#63198786>

---

<div class="post-metadata">

**Author:** ![randyzwitch](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/randyzwitch/32/58772_2.png) [@randyzwitch](https://discuss.streamlit.io/u/randyzwitch)\
**Post date:** [January 12, 2022, 9:40pm UTC](https://discuss.streamlit.io/t/keyerror-selector-while-deploying-streamlit-python-app-on-heroku/4663/3 "2022-01-12T21:40:38Z")

</div>


