Hello,
I am running an app that performs a query; receives a json object, parses it, creates a dataframe from it, and then displays the results in the browser via dash. I am getting the following error when I run certain queries, but do not get this exception for smaller data queries:
2022-05-03 02:14:36 Exception on /_dash-update-component [POST]#012Traceback (most recent call last):#012 File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2051, in wsgi_app#012 response = self.full_dispatch_request()#012 File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1501, in full_dispatch_request#012 rv = self.handle_user_exception(e)#012 File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1499, in full_dispatch_request#012 rv = self.dispatch_request()#012 File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1485, in dispatch_request#012 return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)#012 File "/home/shussai2/.local/lib/python3.7/site-packages/dash/dash.py", line 1345, in dispatch#012 response.set_data(func(*args, outputs_list=outputs_list))#012 File "/home/shussai2/.local/lib/python3.7/site-packages/dash/_callback.py", line 151, in add_context#012 output_value = func(*func_args,
I don't think I am even seeing the complete trace in the error log. Anyway, the app I have woks fine locally (python 3.7, spyder, anaconda 3.0, dash1.7.0, dash-bootstrap-components 1.0.0, dash-core-components 1.6.0, dash-html-components 1.0.2, flask 1.1.1, python 3.7.4), I do not see this error and query is performed and displayed correctly.
However, when I run it in my pythonanywhere site, I see this error for certain queries. I notice it typically throws the exception at the following lines in queries.py:
for col_name in all_df.columns:
print(col_name)
# Works fine and prints out all the columns in the df
print("\nBefore RECALL shorter_recall_df creation")
# Throws exception when I try to create a 'res_event_number',
# df with specific columns of the all_df
shorter_recall_df = all_df[['recalling_firm',
'product_res_number',
'k_numbers',
'recall_status',
'event_date_initiated',
'product_quantity',
'reason_for_recall',
'root_cause_description',
'product_description',
'distribution_pattern',
'action',
'firm_fei_number',
'cfres_id',
'other_submission_description',
'event_date_terminated'
]]
print("\nPrint shorter_recall_df:")
print(shorter_recall_df)
print("\nPrint column names of shorter_recall_df:")
for col_name in shorter_recall_df.columns:
print(col_name)
Please let me know where I am making a mistake and how to resolve this issue.