PIL doesn't work properly after deployment on Community Cloud

Hi community!
When I run my app from my computer I can see the images


but when I deployed the app on streamlit Cloud it drop this message:

Traceback (most recent call last):

  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script

    exec(code, module.__dict__)

  File "/app/ai_speech_tools/Home.py", line 13, in <module>

    img= Image.open(r'media\undraw_Chat_bot_re_e2gj.png')

  File "/home/appuser/venv/lib/python3.9/site-packages/PIL/Image.py", line 3227, in open

    fp = builtins.open(filename, "rb")

FileNotFoundError: [Errno 2] No such file or directory: 'media\\undraw_Chat_bot_re_e2gj.png'

it says that:
FileNotFoundError: [Errno 2] No such file or directory: 'media\\undraw_Chat_bot_re_e2gj.png'

but in the repository I can see the image on the folder:

and as I said above, when I run the app on my computer, I can see the picture.

The code of Home.py is:

import streamlit as st
from PIL import Image

left_column, right_column = st.columns(2)
with left_column:
    st.header('Welcome to ai Quick Tools')
    st.write('Choose a tool from the left menu')

with right_column:
        img= Image.open(r'media\undraw_Chat_bot_re_e2gj.png')

I’m newbie in programming so I really don’t understand the reason why is happening this.
If someone knows, really appreciate your help!

Unfortunately both your app and github repo are private, so we can’t see anything.

sorry @Franky1 I just change to public the repository and the app


img= Image.open('media/undraw_Chat_bot_re_e2gj.png')

Thank you so much @Franky1 , now is solved!

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