Path of '../config.yaml' file for streamlit-authenticator

I put my ‘config.yaml’ file for streamlit-authenticator at the root directory of my github repository which is same folder with the ‘’ file for the app. But I’m encountering with this error. Should I change the code about the path of the ‘config.yaml’ file(‘…/config.yaml’), or do something else like adding codes into ‘requirements.txt’ file?

Error message:

Traceback (most recent call last):
  File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/", line 552, in _run_script
    exec(code, module.__dict__)
  File "/mount/src/project/", line 12, in <module>
    with open('../config.yaml') as file:
FileNotFoundError: [Errno 2] No such file or directory: '../config.yaml'

Code of the ‘’ file for the app:

import pandas as pd
import streamlit as st
import plotly as pl
from datetime import datetime
import streamlit_authenticator as stauth
import yaml
from yaml.loader import SafeLoader
with open('../config.yaml') as file:
    config = yaml.load(file, Loader=SafeLoader)

Code of the ‘requirements.txt’ file:


Please let me know how to solve this error so that I can import the ‘config.yaml’ file successfully for the streamlit-authenticator.

with open('config.yaml') as file:

Wow! Thank you for your help! I solved that problem!

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