Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e0ba087

Browse files
committed
Allow file without filetype as long as they end in ".py".
Added a -D flag (can really only be specified on OSX commandline) to not revector sys.stderr, for debugging the IDE itself. Not sure whether this should stay.
1 parent b2e33fe commit e0ba087

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

Mac/Tools/IDE/PythonIDEMain.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import Wapplication
77
import W
88
import os
9+
import sys
910
import macfs
1011
import MacOS
1112

@@ -42,9 +43,16 @@ def __init__(self):
4243
self.quitevent)
4344
import PyConsole, PyEdit
4445
Splash.wait()
46+
# With -D option (OSX command line only) keep stderr, for debugging the IDE
47+
# itself.
48+
debug_stderr = None
49+
if sys.argv[1] == '-D':
50+
debug_stderr = sys.stderr
51+
del sys.argv[1]
4552
PyConsole.installoutput()
4653
PyConsole.installconsole()
47-
import sys
54+
if debug_stderr:
55+
sys.stderr = debug_stderr
4856
for path in sys.argv[1:]:
4957
self.opendoc(path)
5058
try:
@@ -171,6 +179,8 @@ def opendoc(self, path):
171179
fcreator, ftype = macfs.FSSpec(path).GetCreatorType()
172180
if ftype == 'TEXT':
173181
self.openscript(path)
182+
elif ftype == '\0\0\0\0' and path[-3:] == '.py':
183+
self.openscript(path)
174184
else:
175185
W.Message("Can't open file of type '%s'." % ftype)
176186

0 commit comments

Comments
 (0)