mirror of https://github.com/python/cpython.git
- imp seems to always want a file object arg
- continue if resource file not found (may be an applet)
This commit is contained in:
parent
0223aa11d8
commit
fbac4bbf67
|
@ -24,9 +24,9 @@
|
||||||
def import_as_main(name):
|
def import_as_main(name):
|
||||||
fp, path, (suffix, mode, type) = imp.find_module(name)
|
fp, path, (suffix, mode, type) = imp.find_module(name)
|
||||||
if type == imp.PY_SOURCE:
|
if type == imp.PY_SOURCE:
|
||||||
imp.load_source('__main__', path)
|
imp.load_source('__main__', path, fp)
|
||||||
elif type == imp.PY_COMPILED:
|
elif type == imp.PY_COMPILED:
|
||||||
imp.load_compiled('__main__', path)
|
imp.load_compiled('__main__', path, fp)
|
||||||
elif type == imp.PY_RESOURCE:
|
elif type == imp.PY_RESOURCE:
|
||||||
imp.load_resource('__main__', path)
|
imp.load_resource('__main__', path)
|
||||||
|
|
||||||
|
@ -84,7 +84,10 @@ def interact():
|
||||||
def main():
|
def main():
|
||||||
curdir = os.getcwd()
|
curdir = os.getcwd()
|
||||||
import Res
|
import Res
|
||||||
Res.OpenResFile('RunLibScript.rsrc')
|
try:
|
||||||
|
Res.OpenResFile('RunLibScript.rsrc')
|
||||||
|
except:
|
||||||
|
pass # Assume we're an applet already
|
||||||
name, argv, stdin, stdout, wdir, pause = interact()
|
name, argv, stdin, stdout, wdir, pause = interact()
|
||||||
if not name:
|
if not name:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
Loading…
Reference in New Issue