How I can solve this issue? Error: 'th path' is not UTF-8 format

I am running a code. I keep getting this error! I do not know why. note that the program is running and I see episodes. but at the end the output file is not created. and I see this message in the output file:

Error: 'path of my npy file' is not UTF-8 format

saving disabled

see consol for more details

How file is created:

 # save the weights when we are done
  if args.mode == 'train':
    # save the DQN'{models_folder}/linear.npz')

    # save the scaler
    with open(f'{models_folder}/scaler.pkl', 'wb') as f:
      pickle.dump(scaler, f)

    # plot losses

  # save portfolio value for each episode'{rewards_folder}/{args.mode}.npy', portfolio_value)

How I read the file:

if args.mode == 'test':

with open(f'{models_folder}/scaler.pkl', 'rb') as f:

 ` scaler = pickle.load(f)`