I would like to raise a question about the browser error

After I execute the code below, there is a full screen in the data display. When I click on this full screen browser, an error will be reported. There is a problem with this page. Error code: STATUS_BREAKPOINT.
I don’t know where the problem is. I’m wondering if it’s a cache problem, but after I restarted streamlit, the problem still exists. So I want to ask the community how to solve it.

streamlit 1.29.0
Python 3.11.7

import re
import streamlit as st
import pandas as pd
import streamlit.components.v1 as components
from pygwalker.api.streamlit import init_streamlit_comm, get_streamlit_html

st.set_page_config(page_title='Data File Processing', layout='wide')
st.title('Data File Processing')

# Initialize Pygwalker communication

def build_upload_file():
    Create a file upload widget.
    Users can upload files in '.xlsx' and '.csv' formats.
    If an unsupported file format is uploaded, display an error message.
    If no file is uploaded, the Streamlit app will stop.
    Return: The uploaded file object.
    uploaded_file = st.file_uploader("Select Data File", type=['xlsx', 'csv'])

    if uploaded_file is None:
    elif not uploaded_file.name.endswith(('.xlsx', '.csv')):
        st.error("Unsupported file format. Please upload a file in '.xlsx' or '.csv' format.")

    return uploaded_file

@st.cache_data(ttl=600, max_entries=100, show_spinner='Loading data...')
def load_data(uploaded_file):
    Read data according to file type.
    For Excel files, use pd.read_excel.
    For CSV files, use pd.read_csv.
    Return: A dictionary containing all worksheets for Excel files, or a single DataFrame for CSV files.
    if uploaded_file.name.endswith('.xlsx'):
        return pd.read_excel(uploaded_file, sheet_name=None)  # Read all worksheets in Excel file
    elif uploaded_file.name.endswith('.csv'):
        return {"Sheet1": pd.read_csv(uploaded_file)}  # Create a dictionary with a single key to accommodate sheet selection logic
        st.error("Unsupported file format. Please upload a file in '.xlsx' or '.csv' format.")

def build_sheet_select(dfs):
    Create a multi-select widget that allows users to select which worksheets to view and process.
    For Excel files, display the names of all worksheets.
    For CSV files, display "Sheet1".
    If no worksheets are selected, the Streamlit app will stop.
    Return: The list of worksheets selected by the user.
    # If the input is a DataFrame, it means it's a CSV file with no worksheet names, return the default Sheet1
    if isinstance(dfs, pd.DataFrame):
        return ['Sheet1']

    # If it's a dictionary, it means it's an Excel file, return all worksheet names
    names = list(dfs.keys())
    sheet_selects = st.multiselect('Worksheets', names, [])
    if len(sheet_selects) == 0:
    return sheet_selects

def build_field_selector(sheet_name, df):
    Let the user select the fields they want to display.
    all_columns = df.columns.tolist()
    selected_columns = st.multiselect(f"Select fields for {sheet_name} worksheet", all_columns, all_columns, key=f'{sheet_name}_field_select')
    return selected_columns

def build_filters(sheet_name, df, selected_columns):
    Create filters for the specified worksheet.
    For each object-type column, create a multi-select box to let users choose the values for filtering.
    Return: The DataFrame after applying the filter conditions.
    with st.expander('Filter'):
        filter_options = st.text_input('Enter filter keywords (separated by commas or spaces)', key=f'{sheet_name}_filter_input')
        if filter_options:
            filter_keywords = re.split(r'[,\s]+', filter_options)
            df = df[df.apply(lambda x: any(keyword.lower() in str(v).lower() for v in x for keyword in filter_keywords),
        for col in selected_columns:
            # Attempt to sort the column, capture exceptions on failure
                sorted_values = df[col].drop_duplicates().sort_values()
            except TypeError:
                # If sorting fails (possibly due to mixed data types), convert to string to sort
                sorted_values = df[col].astype(str).drop_duplicates().sort_values()
            selected_values = st.multiselect(f"{sheet_name} - {col}", sorted_values, key=f'{sheet_name}_{col}')
            if selected_values:
                # Assuming the selected values are all string types, filter based on the selected strings
                df = df[df[col].astype(str).isin(selected_values)]
    return df

@st.cache_data(ttl=600, max_entries=100)     # Cache duration 600s, max entries 100
def get_pyg_html(df: pd.DataFrame) -> str:
    Use Pygwalker to process the given DataFrame and generate HTML code.
    This is a cached function to prevent repeated calculations and memory overflow.
    Return: The HTML string containing Pygwalker processing results.
    html = get_streamlit_html(df, spec="./gw0.json", use_kernel_calc=True, debug=False)
    return html

def build_sheet_tabs(sheet_selects, dfs):
    Create a tab for each selected worksheet.
    In each tab, display the filter and DataFrame and show the results from Pygwalker.
    tabs = st.tabs(sheet_selects)  # Create a group of tabs
    for tab, sheet_name in zip(tabs, sheet_selects):
        with tab:  # Operate within the corresponding tab
            df = dfs[sheet_name]
            selected_columns = build_field_selector(sheet_name, df)
            # Check if at least one field is selected
            if not selected_columns:
                st.error("You should select at least one field. QAQ ~")
            df = df[selected_columns]  # Only retain the fields selected by the user
            filtered_df = build_filters(sheet_name, df, selected_columns)
            pyg_html = get_pyg_html(filtered_df)
            components.html(pyg_html, height=1000, scrolling=True)

file = build_upload_file()
dfss = load_data(file)
sheets = build_sheet_select(dfss)
build_sheet_tabs(sheets, dfss)

I still used pygwalker=0.3.18

Hey @lijianqiao,

Please update your post to include the full error message, a link to the GitHub repo for your app, and a link to the deployed app.

Sorry, I just have a single python file and haven’t uploaded it to github. I looked at the debugger and browser console and it reported no error message, only the error code of the browser crash.

I simplified my code today and found that the problem is still the same. When clicking full screen, the browser error code is: STATUS_BREAKPOINT.
Below is my code:

import streamlit as st
import pandas as pd

uploaded_file = st.file_uploader("upload file...")

if uploaded_file is not None:
    if uploaded_file.name.endswith('.csv'):
        df = pd.read_csv(uploaded_file)
    elif uploaded_file.name.endswith('.xlsx'):
        df = pd.read_excel(uploaded_file)
        st.error("Unsupported file format")
        df = None

    if df is not None:

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