Another PyCharm debug question.
Trying to get the debugger running in PyCharm. Here’s my run config:
dataframe.py:
import streamlit as st
import pandas as pd
# Matplotlib must be imported or the code will fail.
import matplotlib.pyplot as plt # Ensure Matplotlib is imported
st.title("DataFrame Formatting Example")
# Create a sample DataFrame
df = pd.DataFrame({
'Name': ['Alice', 'Bob', 'Charlie'],
'Age': [24, 27, 22],
'Score': [85, 90, 95]
})
# Display DataFrame with default styling
st.dataframe(df)
# Custom styling using pandas
styled_df = df.style.background_gradient(cmap='Blues')
st.dataframe(styled_df)
Here’s the terminal when the RUN mode is used: (works fine)
Heres the terminal output when running in debug mode:
import sys; print('Python %s on %s' % (sys.version, sys.platform))
C:\Users\pmora\Documents\Git\GitHub\StreamLitTest\StreamLitTest\.venv\Scripts\python.exe -X pycache_prefix=C:\Users\pmora\AppData\Local\JetBrains\PyCharm2024.1\cpython-cache C:\Users\pmora\AppData\Roaming\JetBrains\PyCharm2024.1\plugins\evaluate-async-code\_pydevd_async_debug.py "C:/Program Files/JetBrains/PyCharm 2023.1.3/plugins/python/helpers/pydev/pydevd.py" --multiprocess --qt-support=auto --client 127.0.0.1 --port 49893 --file .venv\Scripts\streamlit.exe run dataframe.py
Connected to pydev debugger (build 241.18034.82)
Traceback (most recent call last):
File "C:\Users\pmora\AppData\Local\Programs\Python\Python311\Lib\tokenize.py", line 334, in find_cookie
line_string = line.decode('utf-8')
^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 2: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\pmora\AppData\Local\Programs\Python\Python311\Lib\tokenize.py", line 398, in open
encoding, lines = detect_encoding(buffer.readline)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pmora\AppData\Local\Programs\Python\Python311\Lib\tokenize.py", line 375, in detect_encoding
encoding = find_cookie(first)
^^^^^^^^^^^^^^^^^^
File "C:\Users\pmora\AppData\Local\Programs\Python\Python311\Lib\tokenize.py", line 339, in find_cookie
raise SyntaxError(msg)
SyntaxError: invalid or missing encoding declaration for '.venv\\Scripts\\streamlit.exe'
python-BaseException
Streamlit, version 1.36.0
Python 3.11.4
PyCharm 2024.1.4 (Build #PY-241.18034.82, built on June 24, 2024)
Any ideas/ comments? It looks like it might be an asyncio debugger issue in PyCharm???