From: Jack Jansen Date: Tue, 29 Oct 2002 22:03:45 +0000 (+0000) Subject: Added a few printfs in case of unexpected situations during application startup. X-Git-Tag: v2.2.3c1~267 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dbb8c75ba08491ff876b1faed384aeccc3b20358;p=thirdparty%2FPython%2Fcpython.git Added a few printfs in case of unexpected situations during application startup. --- diff --git a/Mac/Python/macgetargv.c b/Mac/Python/macgetargv.c index 8fdbad508726..c7fda1b2ae85 100644 --- a/Mac/Python/macgetargv.c +++ b/Mac/Python/macgetargv.c @@ -97,10 +97,14 @@ PyMac_init_process_location(void) info.processInfoLength = sizeof(ProcessInfoRec); info.processName = NULL; info.processAppSpec = &PyMac_ApplicationFSSpec; - if ( err=GetProcessInformation(¤tPSN, &info)) + if ( err=GetProcessInformation(¤tPSN, &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 */ diff --git a/Mac/Python/macmain.c b/Mac/Python/macmain.c index 71b42e9e922f..9298d33b605d 100644 --- a/Mac/Python/macmain.c +++ b/Mac/Python/macmain.c @@ -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