Even though I have it set to save to savefile.dat nothing actually saves preventing players from loading their game.

I have tried compiling what the game is saving, I have also tried changing what the game is saving to.

#loading 
        with open('savefile.dat', 'rb') as f:
                pl, gold, exp, max_hp, strength, intelligence, stealth, stamina, magic = pickle.load(f)



#saving
                with open('savefile.dat', 'wb') as f:
                        pickle.dump([pl, gold, exp, max_hp, strength, intelligence, stealth, stamina, magic], f, protocol=2)

#the error

Traceback (most recent call last): File "C:\Users\zombiekillez\Desktop\my game\game.py", line 8, in pl, gold, exp, max_hp, strength, intelligence, stealth, stamina, magic = pickle.load(f) EOFError: Ran out of input

I want it to save and load but instead, it just tells me that the file did not save when I try loading, no errors on saving but nothing happens. I have actually looked at the file being saved to and nothing was supposed to be saved in it.

0 Answers