Closed dnicolson closed 4 years ago
It works fine for me... something must have been built incorrectly. which cython version is it?
$ cython --version
Cython version 0.29.2
I'm using a different setup at the moment, is it possible to see some example code of how it is supposed to be used with Cython?
If cython is installed and you build libplist (and did not specify --without-cython during configure/autogen) it compiles a python module for you. When you install it appropriately so that python can find it (usually sudo make install
does) you can just do:
import plist
f = open("test.plist", "r")
pl = plist.load(f)
print(pl)
First I removed the other instances of Python (including from Homebrew dependencies). This is running on macOS 10.15.2 (19C57).
sudo easy_install cython
cython --version
Cython version 0.29.14
git clone git@github.com:libimobiledevice/libplist.git
cd libplist
./autogen.sh
make
sudo make install
At this point both python
and python3
cannot run import plist
.
cd cython
cat >setup.py <<END
from distutils.core import setup
from Cython.Build import cythonize
setup(name='Plist',
ext_modules=cythonize('plist.pyx'))
END
python setup.py build_ext --inplace
Now, the following occurs:
python -c 'import plist'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: dlopen(./plist.so, 2): no suitable image found. Did find:
file system relative paths not allowed in hardened programs
python3 -c 'import plist'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: dlopen(/Users/dave/libplist/cython/plist.so, 2): Symbol not found: _PyClass_Type
Referenced from: /Users/dave/libplist/cython/plist.so
Expected in: flat namespace
in /Users/dave/libplist/cython/plist.so
The above compilation steps are not necessary. On Ubuntu no special steps are required, the compiled files are written to and read from the dist-packages
directory.
On macOS the compiled files are written to the site-packages
directory but the PYTHONPATH
environment variable must be defined for imports to work correctly:
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages
The following error message appears when importing plist:
Cython was setup using the following command and script:
Alternatively using
pyximport
results in the following error:macOS 10.14.6 (18G1012).