[Cython] Status

John Skaller2 skaller at internode.on.net
Thu Jan 30 02:44:02 EST 2020



> On 30 Jan 2020, at 17:20, John Skaller2 <skaller at internode.on.net> wrote:
> 
> Just FYI, trying to load my extension I get “ModuleNotFound”.

using Cython I get a different result.

~/felix>cat oldtest.py
def testit():
  print("Testit”)

Note the original name was test.py, changed so it cannot be loaded. Under the original name:

~/felix>python ../cython/cython.py test.py
/Users/skaller/cython/Cython/Compiler/Main.py:344: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /Users/skaller/felix/test.py
  tree = Parsing.p_module(s, pxd, full_module_name)

That made a C file. Now to compile it:

~/felix>clang -I /usr/local/opt/python/Frameworks/Python.framework/Versions/3.6/include/python3.6m/ -L /usr/local/opt/python/Frameworks/Python.framework/Versions/3.6/lib -lpython3.6m  -dynamic -shared -o test.dylib test.c
~/felix>ls test.dylib
test.dylib
~/felix>mv test.py oldtest.py
~/felix>/usr/local/opt/python/Frameworks/Python.framework/Versions/3.6/bin/python3.6m
Python 3.6.5 (default, Apr 25 2018, 14:26:36)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import test
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: bad magic number in 'test': b'\x03\xf3\r\n’

Well, this is a better result than from the C generated by Felix. At least the extension
module actually got found, even if it failed a consistency check.

Any idea what’s happening? 

[the Cython seems to have been built for 2.7, I don’t know if that
makes any difference: it’s run by command “python” which is Python 2.7.
But the languagfe of the translator isn’t necessarily related to the target
of its output .. there’s no reference for the command line compiler]

—
John Skaller
skaller at internode.on.net







More information about the cython-devel mailing list