How to upload .sav (spss) file via st.uploader

i am new to streamlit. I am trying to upload spss file via st.uploader but i am getting this error.

TypeError: expected str, bytes or os.PathLike object, not UploadedFile

#Folloaing is the code

file = st.file_uploader(“Please choose a file”)

if file is not None:

#To read file as bytes:

bytes_data = file.getvalue()


#To convert to a string based IO:

stringio = StringIO(file.getvalue().decode("latin1")) #(when i tried utf-8 i got cant convert utf-8 at a axx position. so i changed it to latin1 but now i am getting above metioned error)


#To read file as string:

string_data =


#Can be used wherever a "file-like" object is accepted:

df= pd.read_spss(file)