[issue5413] urllib ctypes error on Mac OS X Server 10.5

2009-03-03 Thread Attila Soki

New submission from Attila Soki :

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 
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 > 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 
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/_ct

[issue5413] urllib ctypes error on Mac OS X Server 10.5

2009-04-01 Thread Attila Soki

Attila Soki  added the comment:

no luck.
output for t.py:

Traceback (most recent call last):
  File "t.py", line 3, in 
f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query";, params)
  File "/var/root/pytest/python/lib/python2.6/urllib.py", line 82, in
urlopen
opener = FancyURLopener()
  File "/var/root/pytest/python/lib/python2.6/urllib.py", line 611, in
__init__
URLopener.__init__(self, *args, **kwargs)
  File "/var/root/pytest/python/lib/python2.6/urllib.py", line 129, in
__init__
proxies = getproxies()
  File "/var/root/pytest/python/lib/python2.6/urllib.py", line 1558, in
getproxies
return getproxies_environment() or getproxies_macosx_sysconf()
  File "/var/root/pytest/python/lib/python2.6/urllib.py", line 1452, in
getproxies_macosx_sysconf
_CFSetup(sc)
TypeError: _CFSetup() takes exactly 2 arguments (1 given)
Exception AttributeError: "FancyURLopener instance has no attribute
'tempcache'" in > ignored


output for tt.py:

Traceback (most recent call last):
  File "tt.py", line 4, in 
x = sc.CFStringCreateWithCString(0, "HTTPEnable", 0)
  File "/var/root/pytest/python/lib/python2.6/ctypes/__init__.py", line
366, in __getattr__
func = self.__getitem__(name)
  File "/var/root/pytest/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

notes:
t.py fails on both with the same error
tt.py runs on Intel/Mac OS X and fails on PPC/Mac OS X Server

--

___
Python tracker 
<http://bugs.python.org/issue5413>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com