I am using Cython 0.20.1 with Python 3.3 in 64 bit Windows 7, with latest TDM-GCC installed (it's only a problem with gcc... MSVC does not report this).
Here is the test_cy.pyx
file:
import numpy as np
cpdef func():
cdef double [:] a = np.arange(10)
return a
And then, I used this setup_test.py
:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy as np
extensions = [
Extension('test_cy', ['test_cy.pyx'], include_dirs = [np.get_include()]),
]
setup(
ext_modules = cythonize(extensions)
)
In the command console, I used:
python setup_test.py build_ext --inplace --compiler=mingw32
And it compiled fine. However, when I tried to import the module in python using import test_cy
, it says:
---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-2-533d835504db> in <module>()
----> 1 import test_cy
X:\WorkFolder\DataAnalysis\lw9pg\mol\stringsource in init test_cy (test_cy.c:13209)()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 1: invalid start byte
Could anyone help me with this?
Thank you!