diff --git a/spyderlib/plugins/editor.py b/spyderlib/plugins/editor.py index dd6a9269415..899c465fc0c 100644 --- a/spyderlib/plugins/editor.py +++ b/spyderlib/plugins/editor.py @@ -382,8 +382,14 @@ def __init__(self, parent, ignore_last_opened_files=False): # Creating template if it doesn't already exist if not osp.isfile(self.TEMPLATE_PATH): - header = ['# -*- coding: utf-8 -*-', '"""', 'Created on %(date)s', - '', '@author: %(username)s', '"""', ''] + if os.name == "nt": + shebang = [] + else: + shebang = ['#!/usr/bin/env python' + ('2' if PY2 else '3')] + header = shebang + [ + '# -*- coding: utf-8 -*-', + '"""', 'Created on %(date)s', '', + '@author: %(username)s', '"""', ''] encoding.write(os.linesep.join(header), self.TEMPLATE_PATH, 'utf-8') self.projectexplorer = None