diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1995-08-31 13:46:13 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1995-08-31 13:46:13 (GMT) |
commit | fbac4bbf67b11c6a78dbecdd1adee64e68247b9d (patch) | |
tree | cfe4926a60c96497cdcb1dd5f50541357f5ed247 /Mac/scripts/RunLibScript.py | |
parent | 0223aa11d886e04c29e45eb01a37c8d59c90f499 (diff) | |
download | cpython-fbac4bbf67b11c6a78dbecdd1adee64e68247b9d.zip cpython-fbac4bbf67b11c6a78dbecdd1adee64e68247b9d.tar.gz cpython-fbac4bbf67b11c6a78dbecdd1adee64e68247b9d.tar.bz2 |
- imp seems to always want a file object arg
- continue if resource file not found (may be an applet)
Diffstat (limited to 'Mac/scripts/RunLibScript.py')
-rw-r--r-- | Mac/scripts/RunLibScript.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Mac/scripts/RunLibScript.py b/Mac/scripts/RunLibScript.py index 36e9487..3a9ab7e 100644 --- a/Mac/scripts/RunLibScript.py +++ b/Mac/scripts/RunLibScript.py @@ -24,9 +24,9 @@ PAUSE=10 def import_as_main(name): fp, path, (suffix, mode, type) = imp.find_module(name) if type == imp.PY_SOURCE: - imp.load_source('__main__', path) + imp.load_source('__main__', path, fp) elif type == imp.PY_COMPILED: - imp.load_compiled('__main__', path) + imp.load_compiled('__main__', path, fp) elif type == imp.PY_RESOURCE: imp.load_resource('__main__', path) @@ -84,7 +84,10 @@ def interact(): def main(): curdir = os.getcwd() 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() if not name: sys.exit(0) |