List Info

Thread: P4Python, MySQLdb, or Python Extensions




P4Python, MySQLdb, or Python Extensions
user name
2007-10-08 15:57:03

Hello everyone,

Short time lurker, first time poster.

I'm trying to install P4Python and MySQLdb, but am running into a host of issues.

The trouble I've had trying to install these two and the number of similar experiences I've read through googling leads me to believe that Python can be difficult on the Mac.

I will talk about P4Python as it seems to be the easier of the two. I'm trying to compile the given c++ file to build a Python Extension, but the setup.py doesn't work as it should be linking in CoreFoundation, but it is not. 

ImportError: Failure linking new module: /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/P4Client.so: Symbol not found: ___CFConstantStringClassReference
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/P4Client.so
  Expected in: dynamic lookup

I tried to use Xcode to build something that can go where the site-packages go. But I have no idea what to build. It is not a dynamic library, it is not a relocatable object, I get this error when I try to import:

Traceback (most recent call last):
&nbsp; File "<stdin>&quot;, line 1, in ?
  File "p4.py", line 19, in ?
 &nbsp;  import P4Client
ImportError: Inappropriate file type for dynamic loading

Has anyone done this? How do I build a Python Extension using Xcode? Or perhaps even better, how do I get setup.py to work on the Mac?

Thanks for any and all tips!
Lyndsey Ferguson

 
Re: P4Python, MySQLdb, or Python Extensions
user name
2007-10-09 09:16:38
.so, if im not mistaken is eather a linux shared library or not a mac shared library (someone correct me if im wrong) try making sure the python version you chose is the one for mac. the best supported python for mac is macpython (distributes in a mac installer package) from the python website but another more linux like one would be the darwinports one or the fink one. Try looking here http://wiki.python.org/moin/MacPython/PythonDistributionsForMac

On 10/8/07, Lyndsey Ferguson < lyndsey.fergusongmail.com">lyndsey.fergusongmail.com> wrote:

Hello everyone,

Short time lurker, first time poster.

I'm trying to install P4Python and MySQLdb, but am running into a host of issues.

The trouble I've had trying to install these two and the number of similar experiences I've read through googling leads me to believe that Python can be difficult on the Mac.

I will talk about P4Python as it seems to be the easier of the two. I'm trying to compile the given c++ file to build a Python Extension, but the setup.py doesn't work as it should be linking in CoreFoundation, but it is not. 

ImportError: Failure linking new module: /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/P4Client.so: Symbol not found: ___CFConstantStringClassReference
 &nbsp;Referenced from: /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/P4Client.so
 &nbsp;Expected in: dynamic lookup

I tried to use Xcode to build something that can go where the site-packages go. But I have no idea what to build. It is not a dynamic library, it is not a relocatable object, I get this error when I try to import:

Traceback (most recent call last):
&nbsp; File "<stdin>&quot;, line 1, in ?
  File "p4.py", line 19, in ?
 &nbsp;  import P4Client
ImportError: Inappropriate file type for dynamic loading

Has anyone done this? How do I build a Python Extension using Xcode? Or perhaps even better, how do I get setup.py to work on the Mac?

Thanks for any and all tips!
Lyndsey Ferguson

 

_______________________________________________
Pythonmac-SIG maillist  -  python.org">Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig




--

"lalalalala! it's not broken because I can use it"

http://linux.slashdot.org/comments.pl?sid=194281&;threshold=1&commentsort=0&amp;mode=thread&cid=15927703
Re: P4Python, MySQLdb, or Python Extensions
user name
2007-10-09 10:59:41
On 10/9/07, Nehemiah Dacres < vivacarliegmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">vivacarliegmail.com > wrote:
.so, if im not mistaken is eather a linux shared library or not a mac shared library (someone correct me if im wrong) try making sure the python version you chose is the one for mac. the best supported python for mac is macpython (distributes in a mac installer package) from the python website but another more linux like one would be the darwinports one or the fink one. Try looking here http://wiki.python.org/moin/MacPython/PythonDistributionsForMac

&nbsp;
Thank you for the reply. I have removed older versions of Python and using your link, installed Python 2.5 for the Macintosh.

After which I tried to build and install with the same problem. But I have solved it and will post it to the author and this list (in case someone follows in my footsteps).

In the setup.py for the Macintosh case, I had to add the "extra_link_args=["-framework&quot;, "Carbon] to the setup call. This works and I was able to run it in python.

Regards,
Lyndsey Ferguson


--
Lyndsey Ferguson
Re: P4Python, MySQLdb, or Python Extensions
country flaguser name
United States
2007-10-09 14:50:44
Lyndsey Ferguson wrote:
> In the setup.py for the Macintosh case, I had to add
the 
> "extra_link_args=["-framework",
"Carbon] to the setup call. This works 
> and I was able to run it in python.

Shouldn't distutils do this for you? Anyone know?

-CHB



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barkernoaa.gov
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )