New submission from Attila Soki <atiw...@gmx.net>: i trying to compile Python 2.6.1 from scratch on Mac OS X Server (ppc). After configure/make/make install i test the compiled python with the followig file (t.py) (example from http://docs.python.org/library/urllib.html):
Contents of /tmp/t.py: ------------- import urllib params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0}) f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query", params) print f.read() ------------- and i get this error: python /tmp/t.py Traceback (most recent call last): File "/tmp/t.py", line 3, in <module> f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query", params) File "/usr/local/test/python/lib/python2.6/urllib.py", line 82, in urlopen opener = FancyURLopener() File "/usr/local/test/python/lib/python2.6/urllib.py", line 611, in __init__ URLopener.__init__(self, *args, **kwargs) File "/usr/local/test/python/lib/python2.6/urllib.py", line 129, in __init__ proxies = getproxies() File "/usr/local/test/python/lib/python2.6/urllib.py", line 1555, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/usr/local/test/python/lib/python2.6/urllib.py", line 1449, in getproxies_macosx_sysconf _CFSetup(sc) File "/usr/local/test/python/lib/python2.6/urllib.py", line 1330, in _CFSetup sc.CFStringCreateWithCString.argtypes = [ c_void_p, c_char_p, c_int32 ] File "/usr/local/test/python/lib/python2.6/ctypes/__init__.py", line 366, in __getattr__ func = self.__getitem__(name) File "/usr/local/test/python/lib/python2.6/ctypes/__init__.py", line 371, in __getitem__ func = self._FuncPtr((name_or_ordinal, self)) AttributeError: dlsym(RTLD_DEFAULT, CFStringCreateWithCString): symbol not found Exception AttributeError: "FancyURLopener instance has no attribute 'tempcache'" in <bound method FancyURLopener.__del__ of <urllib.FancyURLopener instance at 0x3743a0>> ignored than tested it whit this code (Thanks to Ned Deily) See the mailinglist thread at: http://mail.python.org/pipermail/python-list/2009-March/703067.html Contents of /tmp/tt.py: ----------------------- from ctypes import cdll from ctypes.util import find_library sc = cdll.LoadLibrary(find_library("SystemConfiguration")) x = sc.CFStringCreateWithCString(0, "HTTPEnable", 0) ----------------------- /usr/local/test/python/bin/python2.6 /tmp/tt.py Traceback (most recent call last): File "/tmp/tt.py", line 4, in <module> x = sc.CFStringCreateWithCString(0, "HTTPEnable", 0) File "/usr/local/test/python/lib/python2.6/ctypes/__init__.py", line 366, in __getattr__ func = self.__getitem__(name) File "/usr/local/test/python/lib/python2.6/ctypes/__init__.py", line 371, in __getitem__ func = self._FuncPtr((name_or_ordinal, self)) AttributeError: dlsym(RTLD_DEFAULT, CFStringCreateWithCString): symbol not found Both test fails on my PPC Mac and runs without error on my Intel MacBook Some detailed info about the macs: ppc: Model Name: Xserve G5 Model Identifier: RackMac3,1 Processor Name: PowerPC G5 (3.1) Processor Speed: 2.3 GHz Number Of CPUs: 2 L2 Cache (per CPU): 512 KB Boot ROM Version: 5.1.7f2 System Version: Mac OS X Server 10.5.6 (9G55) Kernel Version: Darwin 9.6.0 intel: Model Name: MacBook Pro Model Identifier: MacBookPro3,1 Processor Name: Intel Core 2 Duo Processor Speed: 2.4 GHz Number Of Processors: 1 Total Number Of Cores: 2 L2 Cache: 4 MB Bus Speed: 800 MHz Boot ROM Version: MBP31.0070.B07 SSC Version: 1.16f8 System Version: Mac OS X 10.5.6 (9G55) Kernel Version: Darwin 9.6.0 I recompiled Python-2.6.1 with MACOSX_DEPLOYMENT_TARGET=10.3, but no change.. I updated developertools to xcode312_2621, no change.. Btw.. Python-2.5.4 compiled from scratch works fine. I dig a bit deeper with otool and discover some differences: Intel MacOS.so: Carbon, libSystem.B.dylib, CoreServices, ApplicationServices PPC MacOS.so: Carbon, libmx.A.dylib, libSystem.B.dylib Intel _ctypes.so: libSystem.B.dylib PPC _ctypes.so: libmx.A.dylib, libSystem.B.dylib ----------- Intel with deploymant target 10.3, xcode312: ----------- sh-3.2# otool -L /usr/local/test/python/lib/python2.6/lib-dynload/MacOS.so /usr/local/test/python/lib/python2.6/lib-dynload/MacOS.so: /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 136.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.3) /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 32.0.0) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Applicat ionServices (compatibility version 1.0.0, current version 34.0.0) ------- sh-3.2# otool -L /usr/local/test/python/lib/python2.6/lib-dynload/_ctypes.so /usr/local/test/python/lib/python2.6/lib-dynload/_ctypes.so: /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.3) ---------- PPC with deployment_target 10.3, xcode312_2621 ---------- otool -L /usr/local/test/python/lib/python2.6/lib-dynload/MacOS.so /usr/local/test/python/lib/python2.6/lib-dynload/MacOS.so: /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 136.0.0) /usr/lib/libmx.A.dylib (compatibility version 1.0.0, current version 47.1.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.3) ------- otool -L /usr/local/test/python/lib/python2.6/lib-dynload/_ctypes.so /usr/local/test/python/lib/python2.6/lib-dynload/_ctypes.so: /usr/lib/libmx.A.dylib (compatibility version 1.0.0, current version 47.1.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.3) How i compiled it: export MACOSX_DEPLOYMENT_TARGET=10.5 configure --prefix=/usr/local/test/python make make install How i test: export PYTHONPATH=/usr/local/test/python:/usr/local/test/python/lib/python2.6/site-packages /usr/local/test/python/bin/ is in the PATH python /tmp/t.py ---------- assignee: theller components: Macintosh, ctypes messages: 83111 nosy: atiw...@gmx.net, theller severity: normal status: open title: urllib ctypes error on Mac OS X Server 10.5 type: crash versions: Python 2.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5413> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com