code: def __load_temp_file(self):
          
          if not osp.isfile(self.TEMPFILE_PATH):
              # Creating temporary file
              default = ['# -*- coding: utf-8 -*-',
                         '"""', _("Spyder Editor"), '',
                         _("This is a temporary script file."),
                         '"""', '', '']
              text = os.linesep.join([encoding.to_unicode(qstr)
                                      for qstr in default])
              try:
                  encoding.write(to_text_string(text), self.TEMPFILE_PATH,
                                 'utf-8')
              except EnvironmentError:
                  self.new()
                  return
  
          self.load(self.TEMPFILE_PATH)
docs: Load temporary file from a text file in user home directory