View others edited txt file on my repl

Question:
Im trying to make my python repl log everything every user does and I thought I had done it with the code below.

un = os.environ['REPL_OWNER']
logtime = datetime.now(pytz.timezone('US/Eastern')).strftime('at %I:%M:%S %p on %m/%d/%Y')
    with open('userlogs.txt','a') as file:
        file.write(f'{un} logged on {logtime} \n')
        file.close()

But when I tested it with a different account the file only changed on the different account but not my owner account.

yes. Others get a temporary fork of your repl which gets modified, not your repl. You’ll have to use an external database, or if you make your repl a website, e.g. using Flask, you can use repl auth to get the person’s username and use that for your logs.

1 Like

Okay thank you. Ill try the database, but the flask thing dont work on my chromebook.

Hi @RetroWolf I’m not sure why Flask isn’t working for you on Chromebook as it is being run on Replit, so should work with any device. Can you share a link to the Repl so we can offer some advice?

Its fine I got it to work.