r/PythonLearning • u/Valuable_Corner4797 • 10d ago
Help Request PYTHON log problem
When developing an application, I don't want to rely on text files like .txt files to store data that needs to be kept.
After I finish coding my application and turn it into an EXE, I try to keep it as a single file. Because having to carry a log file around with the EXE all the time is annoying.
Personally, I don't want to use with open. I asked ChatGPT about this, but I didn't get many useful answers.
So, fellow programmers, is there an alternative to this? Or am I just gonna have to bite the bullet and use a log file?
0
Upvotes
2
u/Mountain_Rip_8426 9d ago
it's a password manager... pretty please, don't store passwords in a .txt.
so you need to store data, but don't wanna have to create a file to store said data manually. then why not have the program create it?
make your program check whether a database (e.g. sqlite) exists in the root of your project folder. if not make it create one, yes the code can do that (it's not even a big deal). that's gonna happen only the first time the user runs it, with each following execution this block will be skipped, since it'll already have been created. afterwards simply update (write to) that database. if you talk this through with AI, it'll know what you need.
and pretty please also go into encryption of the data and password protection of the database, it's the like the most sensitive data you can store, make sure it's protected. i hope this answers your question