Ask coding questions

← Back to all posts
problems with reading from .env files
JohnnyWobble (49)

When I try and run my code in fullscreen mode i get error from reading the .env file,

https://storage.googleapis.com/replit/images/1554260233009_c81eeab3a0d5049bdc5da80e75b4c266.pn

but in the side veiw,

https://storage.googleapis.com/replit/images/1554260273119_603e7a7658ef0d395f09c8efc7d01ca3.pn

nothing happens

code

import os
import things

repeat_checker = False

def EasterEggChecker(command):
  global repeat_checker
  prize = 0
  prize = int(os.getenv('prize'))
  phrase = os.getenv('easter_egg')
  if command == phrase and not repeat_checker:
    repeat_checker = True
    os.system('clear')
    print("Nice, you smart, you got the easter egg, now take a screen shot of this and message/comment on the repl, congrats")
    things.gold += prize
  elif command == phrase and repeat_checker:
    print(os.getenv("hatsDown"))

full program,
https://repl.it/@JohnnyWobble/The-Quest-into-Abquoria

Answered by HarperframeInc (456) [earned 5 cycles]
View Answer
Comments
hotnewtop
HarperframeInc (456)

Officially, repl.run will not support environment variables (.env) because it can be leaked. (Repl.run is the full screen version)

We don't load them for security reasons (can be leaked).
-timchen (https://replit.canny.io/bug-reports/p/replrun-not-loading-environment-variables)

If this helped you, please upvote this comment.

JohnnyWobble (49)

@HarperframeInc do you know any method to securely store a string, so other people cannot read it by looking through the code?

HarperframeInc (456)

@JohnnyWobble Sorry, but I have the same problem as you. I currently have no solution.

JohnnyWobble (49)

@mat1 thanks i will look into that