Explorar o código

Merge pull request #28 from jbaiter/master

Add check for `__name__ == "__main__"` to launcher script template
Thomas Kluyver %!s(int64=11) %!d(string=hai) anos
pai
achega
855cd35516
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      nsist/__init__.py

+ 3 - 2
nsist/__init__.py

@@ -165,8 +165,9 @@ if appdata:
 
 {extra_preamble}
 
-from {module} import {func}
-{func}()
+if __name__ == '__main__':
+    from {module} import {func}
+    {func}()
 """
     
     def write_script(self, entrypt, target, extra_preamble=''):