Kindly to resolve this path not found error

Summary

Hello out there, I am creating a login page for my streamlit app. I am getting path not found error after importing all the libraries. Below is the code for the login page.

Steps to reproduce

Code snippet:

import pickle
from pathlib import path
import streamlit_authenticator as stauth
#------- USER AUTHENTUICATION----
names = ["James Dee", "Patrick Kerzuah", "Martina Harris"]
usernames = ["jdee", "pkerzuah", "mharris"]
#load hashed password

file_path = path(data_path).parent / "hashed_pw.pk1"

with file_path.open("rb") as file:
    hashed_password = pickle.load(file)
    authenticator = stauth.Authenticate(names, usernames, hashed_passwords, "Deja Vu Stores Dashboard",
                                    "abcdef", cookie_expiry_days=30)
name, authentication_status, username = authenticator.login("Login", "main")
if authentication_status == False:
    st.error("Username/password is incorrect")
if authentication_status == None:
    st.warning("Please enter your username and password")
if  authentication_status:

Hey @Levis_Kerzuah! :wave:

Is this the entire code? I am asking because it seems the data_path variable is not defined before it is used in the line:

file_path = path(data_path).parent / "hashed_pw.pk1"

You will need to define data_path before using it, like this:

data_path = "your_data_path_here"

Best wishes,
Charly

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