SyntaxError: download.py", line 26 ` ^ SyntaxError: invalid syntax

Hello Streamlit team

File "D:\anaconda3\envs\FMPython\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)File "E:\streamlit_programs\ML\MLMain.py", line 12, in <module>
    import download

Following code generates the above error, although it was working before, download.py is present, why it shows syntax error?

import streamlit as st
from sklearn.metrics import mean_squared_error
from sklearn.metrics import mean_absolute_error
from sklearn.metrics import max_error
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import r2_score
import matplotlib.pyplot as plt
from PIL import Image
import pandas as pd
import os
##
import download    # line 12
import models
from data import DataSource
from metrics import Metrics

if 'webdata' not in st.session_state:
    st.session_state.webdata = 0  
if 'X_train' not in st.session_state:
    st.session_state.X_train = 0    
if 'y_train' not in st.session_state:
    st.session_state.y_train = 0
if 'X_test' not in st.session_state:
    st.session_state.X_test = 0
if 'y_test' not in st.session_state:
    st.session_state.y_test = 0        # line 26
if 'dataset_file' not in st.session_state:
    st.session_state.dataset_file=None


Is the app running locally or is it deployed somewhere?

FWIW your code compiles here without issues.

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