[Pythonmac-SIG] Upgraded to 2.4 and can't make it work
Bob Ippolito
bob at redivi.com
Thu May 26 07:32:32 CEST 2005
You definitely have something that's linking to Python 2.3. Try
DYLD_PRINT_LIBRARIES and/or run it under gdb and backtrace to see
which init function is failing.
% env DYLD_PRINT_LIBRARIES=1 build/ReSTedit.app/Contents/MacOS/ReSTedit
dyld: loaded: /Volumes/Crack/src/WWDC2005/ReSTedit-0/build/
ReSTedit.app/Contents/MacOS/ReSTedit
dyld: loaded: /System/Library/Frameworks/Foundation.framework/
Versions/C/Foundation
dyld: loaded: /System/Library/Frameworks/AppKit.framework/Versions/C/
AppKit
dyld: loaded: /usr/lib/libSystem.B.dylib, cpu-sub-type: 0
dyld: loaded: /usr/lib/libxml2.2.dylib
... and so on (eventually you'll start seeing extensions)
The callstack under gdb will look like this:
#0 0x0026eae0 in init_objc ()
#1 0x100a8d54 in _PyImport_LoadDynamicModule (name=0xbfffb8e0
"objc._objc", pathname=0xbfffb3e0 "/Users/bob/src/pyobjc/build/
lib.darwin-8.1.0-Power_Macintosh-2.4/objc/_objc.so", fp=0x0) at /
Users/bob/src/Python-2.4.1/Python/importdl.c:53
#2 0x100a4e18 in load_module (name=0xbfffb8e0 "objc._objc",
fp=0xa000ddf4, buf=0xbfffb3e0 "/Users/bob/src/pyobjc/build/
lib.darwin-8.1.0-Power_Macintosh-2.4/objc/_objc.so", type=0,
loader=0x0) at /Users/bob/src/Python-2.4.1/Python/import.c:1665
.....
All the init functions are named simply init with the name of the
extension appended (in this case the extension is named _objc).. so
you can future-break on them.
otool -L on any extension file will tell you what it's linked to..
py2app ships with a tool called macho_find which will find all of the
Mach-O files in a folder... uh, here's a script that should help you
find the culprit:
#!/usr/local/bin/python2.4
"""
Usage:
linksto.py /System/Library/Frameworks/AppKit.framework/AppKit build
"""
from macholib.MachOGraph import MachOGraph
from macholib.util import iter_platform_files
def linksto(target, searchpath):
g = MachOGraph()
for path in iter_platform_files(searchpath):
g.run_file(path)
return set(
g.graph.edges[edge_ident][0]
for edge_ident in
g.graph.inc_edges(g.findNode(target).graphident)
)
if __name__ == '__main__':
import sys, os
try:
for path in sorted(linksto(*map(os.path.realpath, sys.argv
[1:]))):
print path
except TypeError:
raise SystemExit, __doc__.strip()
...
% python linksto.py /System/Library/Frameworks/AppKit.framework/
AppKit build
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa
/Volumes/Crack/src/WWDC2005/ReSTedit-0/build/ReSTedit.app/Contents/
MacOS/ReSTedit
/Volumes/Crack/src/WWDC2005/ReSTedit-0/build/ReSTedit.app/Contents/
Resources/Python/lib-dynload/AppKit/_AppKit.so
/Volumes/Crack/src/WWDC2005/ReSTedit-0/build/ReSTedit.app/Contents/
Resources/ReSTeditPlugIn.bundle/Contents/MacOS/ReSTeditPlugIn
/Volumes/Crack/src/WWDC2005/ReSTedit-0/build/ReSTeditPlugIn.bundle/
Contents/MacOS/ReSTeditPlugIn
You'd use it largely the same way, except with Python.framework/
Python instead of AppKit.framework/AppKit
-bob
On May 25, 2005, at 9:48 PM, Kent Quirk wrote:
> Sadly, that was one of the first things we tried. We've done a full
> clean build several times and checked the .xcode project files to make
> sure there were no references to the old python anywhere.
>
> And as I said, the extension as stored in the .app loads properly
> everywhere but from the executable within the app.
>
> Any other ideas?
>
> Kent
>
> -----Original Message-----
> From: Bob Ippolito [mailto:bob at redivi.com]
> Sent: Wednesday, May 25, 2005 11:42 PM
> To: Kent Quirk
> Cc: pythonmac-sig at python.org
> Subject: Re: [Pythonmac-SIG] Upgraded to 2.4 and can't make it work
>
>
> On May 25, 2005, at 8:18 PM, Kent Quirk wrote:
>
>
>> Just because this is really trouble for me, and I'm hoping to get
>> some ideas, I'm going to update with some of the other things we've
>> tried today:
>>
>> a) I updated py2app from svn and rebuilt it on this machine using
>> python2.4 setup.py bdist-mpkg --open
>> Just to make sure it was compatible with the python2.4 I have here.
>>
>> b) We replaced our app's primary .py file with one that does
>> nothing but import our first extension. It broke (thereby
>> confirming that we're not setting up things funny in our .py file).
>>
>> c) I added some import statements for standard python modules:
>>
>> import os
>> import sys
>> import time
>> print "hello"
>> import util # one of our extensions
>>
>> It got through the first 4 lines and crashed on the last one.
>>
>
> Trash your extension and rebuild it against the new python.
>
> -bob
>
>
More information about the Pythonmac-SIG
mailing list