[Python] Streamlit cant pickle load my custom object

Discussão em 'Python' iniciado por Stack, Novembro 30, 2024.

  1. Stack

    Stack Membro Participativo

    ## Packages
    import pickle
    from pathlib import Path
    import streamlit as st

    ## Pathing
    main_path = Path(__file__).parent.parent
    file_path = main_path / 'out' / 'data.pickle'

    ## Load portfolio
    with open(file_path, 'rb') as file:
    pf = pickle.load(file)
    st.title("Hello")


    I have this simple script that pickle loads an object that I created using a custom_library. I can run this file with Python. However, when I try to run it with streamlit, I get an error:

    ModuleNotFoundError: No module named 'custom_library'

    Why are they behaving differently and how can I fix this?

    Continue reading...

Compartilhe esta Página