]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added a few printfs in case of unexpected situations during application startup.
authorJack Jansen <jack.jansen@cwi.nl>
Tue, 29 Oct 2002 22:03:45 +0000 (22:03 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Tue, 29 Oct 2002 22:03:45 +0000 (22:03 +0000)
Mac/Python/macgetargv.c
Mac/Python/macmain.c

index 8fdbad508726f26ca36abe556aae7e84b9db0ad9..c7fda1b2ae85d0d8fc199fcddc3a5d723a3b7846 100644 (file)
@@ -97,10 +97,14 @@ PyMac_init_process_location(void)
        info.processInfoLength = sizeof(ProcessInfoRec);
        info.processName = NULL;
        info.processAppSpec = &PyMac_ApplicationFSSpec;
-       if ( err=GetProcessInformation(&currentPSN, &info))
+       if ( err=GetProcessInformation(&currentPSN, &info)) {
+               fprintf(stderr, "GetProcessInformation failed: error %d\n", err);
                return err;
-       if ( err=PyMac_GetFullPathname(&PyMac_ApplicationFSSpec, PyMac_ApplicationPath, PATHNAMELEN) )
+       }
+       if ( err=PyMac_GetFullPathname(&PyMac_ApplicationFSSpec, PyMac_ApplicationPath, PATHNAMELEN) ) {
+               fprintf(stderr, "PyMac_GetFullPathname failed for application: error %d\n", err);
                return err;
+       }
        applocation_inited = 1;
        return 0;
 }
@@ -141,8 +145,10 @@ static pascal OSErr
 handle_open_app(const AppleEvent *theAppleEvent, AppleEvent *reply, refcontype refCon)
 {
        #pragma unused (reply, refCon)
-#if 0
-       /* Test by Jack: would removing this facilitate debugging? */
+#if 1
+       /* Removing this facilitate debugging: you can start Python under CW and
+        * then double-click a file to run it.
+        */
        got_one = 1;
 #endif
        return get_missing_params(theAppleEvent);
@@ -232,11 +238,12 @@ event_loop(void)
 #if !TARGET_API_MAC_CARBON
                SystemTask();
 #endif
-               ok = GetNextEvent(everyEvent, &event);
+               ok = WaitNextEvent(everyEvent, &event, 1, NULL);
                if (ok && event.what == kHighLevelEvent) {
                        AEProcessAppleEvent(&event);
                }
        }
+       if (!got_one) fprintf(stderr, "Warning: no OAPP or ODOC AppleEvent received\n");
 }
 
 /* Get the argv vector, return argc */
index 71b42e9e922fa03fbf3f359863f7d80b157231c5..9298d33b605defa5c5255eeb32cb6668682b300e 100644 (file)
@@ -336,6 +336,8 @@ init_common(int *argcp, char ***argvp, int embedded)
                        p = strrchr(app_wd, ':');
                        if ( p ) *p = 0;
                        chdir(app_wd);
+               } else {
+                       fprintf(stderr, "Warning: No argv[0], cannot chdir to pythonhome\n");
                }
 #endif
 #endif