How to solve an UCS2-UCS4 python-cython incompatibility

410 views
Skip to first unread message

Uri Elias

unread,
Nov 7, 2013, 4:51:45 PM11/7/13
to cython...@googlegroups.com

Hi all,

I'm running into a cython-unicode problem which I hope you can help me with - 

I'm trying to compile with cython a python module which works alot with unicode objects.

I'm working on Ubuntu 12.04 32bit, (on a VM on a Win7 64bit host if it has any importance), I'm using Py2.5.4 (can't change that) which I've installed side-by-side with the provided Py2.7.3 (and soft-linked /usr/bin/python to /usr/bin/python2.5), and Cython 19.02 (current one). I'm compiling with no special flags.

Now, as compiling goes seemingly OK, when I open a Py (same 2.5.4) and try to import the resulting .so, I get a PyUnicodeUCS2 type error. That is supposed to mean, as I understand, that the SO was compiled on a python configured with UCS4, and imported to python configured with UCS2. BUT It's the same python I compiled on imported..

Can someone enlighten me with what's going on and what I can do with it?

I'll be happy to provide more details if I wasn't clear enough.

Thanks a lot..


Chris Barker

unread,
Nov 7, 2013, 4:59:06 PM11/7/13
to cython-users

Uri,

How are you compiling the extension?

Hopefully with distutils -- in which cae, do make sure you are running distutils (i.e. the setup.py file) with the python you think you are.

-CHB

--
 
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--

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....@noaa.gov

Uri Elias

unread,
Nov 8, 2013, 12:15:24 AM11/8/13
to cython...@googlegroups.com
Yes, with distutils  - setup.py, smth like

from distutils.core import setup
from Cython.Build import cythonize

setup(
  name = 'Hello world app',
  ext_modules = cythonize("hello.pyx"),
)
(thats from docs.Cython) but with distutlis.extension.Extension and Cython.Distutile.build_ext rather than cythonize (does it matter? what is actually the difference?).

then with the command $ python setup.py build_ext --inplace

Now, typing $ python  gives me a Python 2.5.4 prompt, so I believe this is the case for the above command too.


--
 
---
You received this message because you are subscribed to a topic in the Google Groups "cython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cython-users/g_WCTDrdIno/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cython-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages