code: def create_script(fname):
      
      text = os.linesep.join(["# -*- coding: utf-8 -*-", "", ""])
      try:
          encoding.write(to_text_string(text), fname, 'utf-8')
      except EnvironmentError as error:
          QMessageBox.critical(_("Save Error"),
                               _("<b>Unable to save file '%s'</b>"
                                 "<br><br>Error message:<br>%s"
                                 ) % (osp.basename(fname), str(error)))
docs: Create a new Python script