Skip to content
← Back to Community
Need help with files auto delete in repl.it like project files
Profile icon
DiveshTheReal

Need help with files auto delete in repl.it like project files so I use a file to add files to repl.it it auto-delete the files anyone knows how to fix it like the example I use JSON to store a think after some time it auto-delete the info it stores

Answered by SUHASTADIPARTH1 [earned 5 cycles]
View Answer
Voters
Profile icon
NekoTheDev
Profile icon
TheDevBest
Profile icon
DiveshTheReal
Comments
hotnewtop
Profile icon
SUHASTADIPARTH1

Try this:

import os os.remove('file name here...')
Profile icon
OneNose

I think repl.it deletes his file and he wants to fix it, not delete the file himself. @SUHASTADIPARTH1

Profile icon
DiveshTheReal

@SUHASTADIPARTH1 what no like i use a DB that store data in the files so i run the repl when someone enters info it will save in the files and after some time it auto delete

Profile icon
DiveshTheReal
Profile icon
SUHASTADIPARTH1

@DiveshTheReal

So, you might want to try this:

user_input = input('What do you want to write? ') file = open('file.txt', 'w') file.write(user_input)
Profile icon
DiveshTheReal

@SUHASTADIPARTH1 Buddy it's a database i don't want anyone to write on it I only want to store the info they send like it will store auto I test this on my pc and it works only happening to repl.it

Profile icon
SUHASTADIPARTH1

@DiveshTheReal Well, I am not sure how you can do that, but if are using django, I know how to do that.

Profile icon
DiveshTheReal

@SUHASTADIPARTH1 me trying to use nodejs i try to use a file to store the data when a person send it will add to the files after a long time it will delete and be blank

Profile icon
SUHASTADIPARTH1

@DiveshTheReal ok. But I am weak in node.js

Profile icon
DiveshTheReal

@SUHASTADIPARTH1 but thx for trying to help me that was great :3

Profile icon
SUHASTADIPARTH1

@DiveshTheReal np. mark my answer?

Profile icon
SUHASTADIPARTH1

@DiveshTheReal Thank you :)

Profile icon
RYANTADIPARTHI

You can do it in a different way, so by giving users a chance to do it.

import os user_input = input("delete? "): if user_input == "Y": os.remove(file name) else: print("ok")
Profile icon
DiveshTheReal

@RYANTADIPARTHI i don't want to remove it me saying why repl it auto removing the data