0

I am using an exception to detect whether a pickle file exists or not. However, I want it to repeat instead of stopping as soon as the program reaches that exception. How can I achieve this?

Code:

         try:
            print('\n > loading character...')
            w(1)
            save_game_load = save_game_name + '.pickle'
            pickle_in = open(save_game_load,"rb")
            character_save = pickle.load(pickle_in)
            print(' > character loaded successfully')
            w(0.3)
            print('\n > welcome back',character_save['name'],'!')
            print(' > here are your stats from last time: ')
            print('\n >',character_save)
        except:
            print(' > could not find a file with name',save_game_name)
some_user_3
  • 403
  • 1
  • 5
  • 17

0 Answers0