New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
urllib ctypes error on Mac OS X Server 10.5 #49663
Comments
i trying to compile Python 2.6.1 from scratch on Mac OS X Server (ppc). 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) 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: intel: I recompiled Python-2.6.1 with MACOSX_DEPLOYMENT_TARGET=10.3, but no 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, PPC MacOS.so: Carbon, libmx.A.dylib, libSystem.B.dylib Intel _ctypes.so: libSystem.B.dylib ----------- /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Applicat ------- sh-3.2# otool ---------- otool -L /usr/local/test/python/lib/python2.6/lib-dynload/MacOS.so ------- otool -L /usr/local/test/python/lib/python2.6/lib-dynload/_ctypes.so How i compiled it: export MACOSX_DEPLOYMENT_TARGET=10.5 How i test: export |
For more info, see discussion starting here: I suspect a difference in the proxy configuration available between OS X |
I don't have time to investigate this right now, I do have access to a Looking at the code in urllib I found the most likely reason for the BTW. This probably also affects 3.x. |
I don't have a PPC machine handy at the moment, but I hope the attached |
no luck. Traceback (most recent call last):
File "t.py", line 3, in <module>
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 <bound method FancyURLopener.__del__ of
<urllib.FancyURLopener instance at 0x372288>> ignored output for tt.py: Traceback (most recent call last):
File "tt.py", line 4, in <module>
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: |
I'll install 10.5 server on my PPC test machine when I'm back from PyCon, |
The attached patch is not entirely correct, I'm not yet uploading an I cannot reproduce this with a the 2.6.2 installer (build on PPC) nor ProductName: Mac OS X Xcode is: $ xcodebuild -version
Component versions: DevToolsCore-660.0; DevToolsSupport-651.0 I'm currently installing 10.5 server in a VM, and will try to test that BTW. I intend to commit the fixed version of my patch regardless of |
Seems ronald takes care of this issue. |
I've just committed a fix for another issue and that completely removes Therefore this issue should no longer occur and hence can be closed. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: