]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
- imp seems to always want a file object arg
authorJack Jansen <jack.jansen@cwi.nl>
Thu, 31 Aug 1995 13:46:13 +0000 (13:46 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Thu, 31 Aug 1995 13:46:13 +0000 (13:46 +0000)
- continue if resource file not found (may be an applet)

Mac/scripts/RunLibScript.py

index 36e94875083989d976ca62f6bfb12e3af131378b..3a9ab7e056c94be07d655980ab53a19e7cd5b24c 100644 (file)
@@ -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)