Obtaining account name and repl name programmatically
Is there a way to obtain the account name and repl name programmatically, say, via Python?
I've looked at the Linux command-line environment, and the $USER value is "runner."
I'm aware that key/value pairs can be stored in ~/.env, but I wish to avoid having to create and customize a .env file for every repl I create.
import os os.environ['REPL_OWNER'] # the person who's running the repl os.environ['REPL_SLUG'] # the repl name stripped of special characters
Try listing all the environment variables to see if they contain any useful information: https://repl.it/@programmeruser/osenviron#main.py
So I use
import os os.environ['REPL_OWNER']
I might have got the code wrong, but the repl owner is whoever runs the repl. If your in a multiplayer repl, itll just say the owners, but if you run it in the embed on a post, it most likely work. I hop I helped!
I think I can get the name of the repl by grabbing the last part of the path of the pwd command. For example, if pwd is this:
I can retrieve "whatever."
Thanks again for your help, and good luck creating your new programming language!