How to process .apk file uploaded using fileuploader?

I was using the androguard library and tried to process the uploaded .apk file. But it showed the type error :
TypeError: expected str, bytes or os.PathLike object, not _io.BytesIO

This is my app code

import streamlit as st
from androguard.core.bytecodes.apk import APK
st.title('Automated Malware Analysis Tool')
uploaded_apk = st.file_uploader("Upload your APK file", type="apk")
a = APK(uploaded_apk)

Hi @allenpbiju, welcome to the Streamlit community!

st.file_uploader returns a BytesIO object, which is a buffer, which isn’t one of the types that function accepts (as the error message indicates).

To get the bytes from a BytesIO object, you need to read the buffer:

a = APK(

Hi @randyzwitch , thanks for the reply,
but when i try to read the buffer gives me the following error
ValueError: embedded null byte

1 Like