Error with st.experimental_fragment

I have an application that essentially adds the description (text) of a given chart to a dictionary when the user clicks on a button.

I have use st.experimental_fragement so that when I add a new chart, it gets added to the dictionary directly without rerunning.

This works very well in general.

However with one specific chart (see image) it returns an error

This is the “bad” chart. With other 23 charts it works fine.

This is the error .

This is the function

@st.experimental_fragment(run_every=None)
def get_comments_from_data(fig,df,chosenDimension,chartDict,paramDict,fileName):
namingParams=get_naming_params()
columnHash=paramDict[namingParams[“columnHash”]]
getChartCommentLabel=namingParams[“getChartCommentLabel”]
smallMultiplesCharts=namingParams[“plotSmallMultiplesOtherCharts”]
submitCommentName=namingParams[“submitCommentName”]
varianceAnalysisChartKey=namingParams[“varianceAnalysisChart”]
processingChoice=namingParams[“processingChoice”]
runOneDimensionalAnalysis=namingParams[“runOneDimensionalAnalysis”]
chartDataPromptDict=namingParams[“chartDataPromptDict”]
hashString=str(chartDict)
hashKey=get_hashed_key(hashString,columnHash)
value=False
response=“”
submitted=False
disabled=False
if chartDataPromptDict in st.session_state:
if fileName in st.session_state[chartDataPromptDict] and len(st.session_state[chartDataPromptDict][fileName])>0:
disabled=False
colArray=make_three_col_width_array()
tooltip=“”“Add plot to report.”“”
message=“”“:eight_spoked_asterisk:Add plot to report.”“”
submitted=st.button(label=getChartCommentLabel,help=tooltip,key=hashKey,disabled=disabled,type=“primary”)
st.caption(message)
if chartDataPromptDict not in st.session_state:
st.session_state[chartDataPromptDict]={}
smallMultiplesKey=“_No”
if smallMultiplesCharts in chartDict and chartDict[smallMultiplesCharts]:
smallMultiplesKey=“_Yes”
if submitted and (fileName not in st.session_state[chartDataPromptDict]):
st.session_state[submitCommentName] = True
paramDict=get_data_prompt(df,paramDict,chartDict,chosenDimension,fileName)
elif submitted and fileName in st.session_state[chartDataPromptDict] and len(st.session_state[chartDataPromptDict][fileName])==0:
st.session_state[submitCommentName] = True
paramDict=get_data_prompt(df,paramDict,chartDict,chosenDimension,fileName)
elif submitted and fileName in st.session_state[chartDataPromptDict] and len(st.session_state[chartDataPromptDict][fileName])>0 :
message=“”“Plot not added. Plot already in file!”“”
st.caption(“:red[”+message+“]”)
pass
else:
pass
return paramDict

I solved the problem. Nothing to do with stream lit.

My code gave an error. Instead of showing my error, streamline returns the fragment error.

Once I solved my error everything was ok.

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