[Pythonmac-SIG] Porting xattr to Python3; question linking to dynamic library

Adam Morris amorris at mistermorris.com
Sun Jun 5 16:01:41 CEST 2011


Not sure if this is the best place to ask, but you guys have been
helpful in the past:

Apple's python has the xattr module built-in, but I'm writing an app
that needs ("wants") Python 3. I wrote to the author asking if there
was any plans to port xattr to Python 3, and he suggested that it
would be easy enough to do if I were to give it a try. So I have, but
I'm running into a problem when it links to the included dynamic
library:

1) I've used 2to3 script to get the actual code to Python 3
2) I've installed Distribute, (xattr needs setuptools)
3) Ran python3 setup.py install and didn't get any warnings (yay)
4) Manually fixed simple relative import problem that 2to3 missed on
files that setup.py installed, I assume because said file wasn't in
build folder and so didn't detect a relative import
5) Getting ImportError: dlopen(/path/to/xattr/_xattr.so, 2): Symbol
not found: _PyString_AS_STRING

At this point I have a vague understanding of what the problem is.
Python3 strings have changed to Unicode so I assume there's another
symbol (constant?) that I have to use. If so, how do I go about
getting an .so file to avoid getting that error?

I'm additionally really confused by the problem and fix in 4 ... does
this mean that setup.py wrote a file? Or is this how linking to
dynamic libraries work?

The problem is beyond my understanding of the environment that's going
on here. Any help?

-Adam


More information about the Pythonmac-SIG mailing list