Topic was automatically imported from the old Question2Answer platform.
Asked By
Tatuzudo
Hey people,
I’m having a strange error saving a game to a .json file.
The error I’m getting is “ERROR: store_line: Condition ’ !f ’ is true.”
It seems to come from the line of code “save_game.store_line(to_json(fases))”
This is not crashing the game and the game saves and loads normally (both exported and inside the editor).
It’s really annoying though.
Any clue to what could be causing it?
This may be due to multiple reasons. (which I can’t tell because you didn’t post some code)
I.e.: you tried to save your savegame in a res:// path which might fail on exported projects. (res:// is readonly on some platforms).
or: you simply did not create/open the file before before the first store_line
Hey thanks for the answer
I think I can rule out the second example
I updated my question with some code
#2: Personally, I think it is good style to close() the file after use. The destructor may do so implicitly but maybe it does it deferred which may lead to a problem if another file write attempt is done before the close has happened.
#3: If the messages still ocur then try to put some print() before and after the store_line() to see if the error occurs where exactly, every time (also on the first call) and if the error even happens on that spot and not in another location which you weren’t aware of.
wombatstampede | 2019-11-16 12:38
Looks like closing the file solved the problem.
Thank you very much!