Error message when users run project about missing environment variables

Problem description:

when I run my login project it gives me error “key error: password”


import os
import time
password = os.environ['password']
hack_code = os.environ['hack code']
password_entry = ""
while True:
  password_entry = input("enter password: ")
  if password_entry == password:
    print("hack code is " + hack_code)
    print("invalied password")

project link


Have you set the environment variables?
If not check out this link:

1 Like

I’ve moved this to #code-help:python as it isn’t a bug.


I added the environment variables in

I see you are attempting to make “global environmental variables.” These were taken out of replit (that is, .env files have been deprecated). There is currently no way to have public environmental variables, though you could submit a ticket. I suggest you look into encrypting your environmental variables.

Using secrets you can create environment variables which you can access within your code (as this user has done), however you cannot create them in code or use a .env file.

1 Like

Your Problem Solved ?

so what should I do because i am confused by the term “encrypt” to i import a encrytion libary

um yes that is what I would recommend

what does “submit ticket” mean?

Make a post in #feature-requests (and detail it too!)