![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | denxi |
EDIT3: I’m an idiot and was pulling the wrong file in a different section of code because I forgot to stick the rest of the file path string at the beginning of the filename in the load section of the code (not shown here). I got the example code I gave to work by just closing the file, re-opening it, and then calling get_var(), but I still couldn’t pull the data when I tried running it through the actual program. That’s when I saw my error.
This can be closed, sorry.
EDIT2: If I save the file as a text file, I can open it in notepad and see that it’s saved the data. So I guess the problem isn’t with the saving portion, but the get_var().
I’m having a problem with store_var that I haven’t had before, where it’s not storing any information for some reason.
The chunk of code that I have is as follows:
for prof in profiles.values():
var file = File.new()
file.open(save_path + "/" + prof["name"] + ".data", File.WRITE_READ)
file.store_var("1")
print (file.get_var())
file.close()
I have it set up to just store a “1” for testing. Printing the get_var prints “Null.” This is what happens as well when I try to store the actual information that I want to, i.e. “prof”, which is in a dictionary form. It’s creating the file perfectly fine in my file explorer.
No idea why this is happening, I’d appreciate any insight. I’m running win10(64) btw.
EDIT: Also running 3.1 Mono