-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add shebang line to default template.py #3029
Conversation
@@ -382,8 +382,10 @@ 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', '"""', ''] | |||
header = ['#!/usr/bin/env python' + ('2' if PY2 else '3'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should be here only if we are not on Windows, i.e. if not os.name == 'nt'
|
The shebang shouldn't appear on windows now. |
Add shebang line to default template.py
@Nodd Why would you leave out the shebang on Windows? The shebang line is also interpreted on Windows, see https://docs.python.org/3/using/windows.html#shebang-lines and https://www.python.org/dev/peps/pep-0397/. |
@mdraw I left it out because the boss (@ccordoba12) said so ! But since it's interpreted, I'll add it again. |
I'm -1 on adding a shebang to Windows scripts because:
|
I have some counter arguments, but since it's a detail and it's so easy to change I think it's not worth the time. I'll left it as is. |
It makes it easier to run scripts outside of spyder on linux.
The template could be further enhanced (add
if __name__ == "__main__"
for example).