2.x,3.x iOS static build: Fatal Python error: exceptions bootstrapping error.

angeljanai at gmail.com angeljanai at gmail.com
Sun May 20 23:33:56 EDT 2012


Hello!

I'm trying to embed a part of python (core+some modules) in my iOS application for internal scripting. I started from compiling original unmodified Python source. Tried both 2.7.3 and 3.x latest source code. As I found no easy way to configure it, just tried to run configure from Mac OS X(10.7) and it was successful.
After that I created XCode project and added all necessary files from after-configure source. There were some minor problems, but compilation and link errors were fixed very quickly.
Finally I tried to create a test program, which has just this:
...
Py_NoSiteFlag=1;
Py_Initialize();
Py_Finalize();
...
When I run it I getting "Fatal Python error: exceptions bootstrapping error."
Call stack is:
#0	0x300cba1c in __pthread_kill ()
#1	0x362e43ba in pthread_kill ()
#2	0x362dcbfe in abort ()
#3	0x00127d96 in Py_FatalError at /Users/mac_user/Downloads/Python-3.2.3/IOS/pythoncore/../../Python/pythonrun.c:2169
#4	0x00155328 in _PyExc_Init at /Users/mac_user/Downloads/Python-3.2.3/IOS/pythoncore/../../Objects/exceptions.c:2042
#5	0x00127ad4 in Py_InitializeEx at /Users/mac_user/Downloads/Python-3.2.3/IOS/pythoncore/../../Python/pythonrun.c:272
#6	0x0012846a in Py_Initialize at /Users/mac_user/Downloads/Python-3.2.3/IOS/pythoncore/../../Python/pythonrun.c:332
#7	0x000d6242 in testpython at /Users/mac_user/Downloads/Python-3.2.3/IOS/test/test/testmac.c:15
#8	0x000d618e in -[ViewController viewDidLoad] at /Users/mac_user/Downloads/Python-3.2.3/IOS/test/test/ViewController.m:23
#9	0x3283ff0e in -[UIViewController view] ()
#10	0x3283e2b4 in -[UIWindow addRootViewControllerViewIfPossible] ()
#11	0x3283a332 in -[UIWindow _setHidden:forced:] ()
#12	0x3283e28e in -[UIWindow _orderFrontWithoutMakingKey] ()
#13	0x3284cc60 in -[UIWindow makeKeyAndVisible] ()
#14	0x000d5ffe in -[AppDelegate application:didFinishLaunchingWithOptions:] at /Users/mac_user/Downloads/Python-3.2.3/IOS/test/test/AppDelegate.m:35
#15	0x3283e820 in -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] ()
#16	0x32838b64 in -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] ()
#17	0x3280d7d6 in -[UIApplication handleEvent:withNewEvent:] ()
#18	0x3280d214 in -[UIApplication sendEvent:] ()
#19	0x3280cc52 in _UIApplicationHandleEvent ()
#20	0x322b7e76 in PurpleEventCallback ()
#21	0x3113ba96 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#22	0x3113d83e in __CFRunLoopDoSource1 ()

XCode version is 4.3.2.
I tried to debug, and unfortunately I don't understand why this error is occured.
Also tried source from here: http://stackoverflow.com/a/4177748/1337666.
But no luck, same problem.
Porting Python core will be very helpful for my iOS application.
Any hint will be appreciated.
Best Regards



More information about the Python-list mailing list