]> granicus.if.org Git - python/commitdiff
(Tkinter.py): Improve application basename determination to make .py and
authorFred Drake <fdrake@acm.org>
Sun, 6 Oct 1996 17:55:20 +0000 (17:55 +0000)
committerFred Drake <fdrake@acm.org>
Sun, 6 Oct 1996 17:55:20 +0000 (17:55 +0000)
.pyc extensions completely equivelent when locating the "profile"
which should be read on startup.

Lib/lib-tk/Tkinter.py
Lib/tkinter/Tkinter.py

index cd341dd165b6985260ccab2b850122c2e3cc57ab..13886eb21a4260d6d68e74f93a04601498c0ea0a 100644 (file)
@@ -638,7 +638,8 @@ class Tk(Misc, Wm):
                if baseName is None:
                        import sys, os
                        baseName = os.path.basename(sys.argv[0])
-                       if baseName[-3:] == '.py': baseName = baseName[:-3]
+                       baseName, ext = os.path.splitext(baseName)
+                       if ext not in ('.py', 'pyc'): baseName = baseName + ext
                self.tk = tkinter.create(screenName, baseName, className)
                try:
                        # Disable event scanning except for Command-Period
index cd341dd165b6985260ccab2b850122c2e3cc57ab..13886eb21a4260d6d68e74f93a04601498c0ea0a 100755 (executable)
@@ -638,7 +638,8 @@ class Tk(Misc, Wm):
                if baseName is None:
                        import sys, os
                        baseName = os.path.basename(sys.argv[0])
-                       if baseName[-3:] == '.py': baseName = baseName[:-3]
+                       baseName, ext = os.path.splitext(baseName)
+                       if ext not in ('.py', 'pyc'): baseName = baseName + ext
                self.tk = tkinter.create(screenName, baseName, className)
                try:
                        # Disable event scanning except for Command-Period