Robert Bradshaw | 2 Feb 11:36 2011

Re: possible to check python version on import

On Mon, Jan 31, 2011 at 2:22 AM, Sebastian Haase <seb.haase <at>> wrote:
> Hi,
> I am trying to do my first steps with cython.
> By accident I compiled with python2.6 while I'm otherwise using Python 2.5.
> So the error I got was:
>>>> primes.primes(4)
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "primes.pyx", line 3, in primes.primes (primes.c:443)
>    def primes(int kmax):
> TypeError: __int__ returned non-int (type int)
> Is there any way to check python versions of a module - at least to
> give a warning... ?

That's a good idea, can anyone think of a reason this should not be done?

> shaase <at> iris:~/qq/cython: cd Demos/
> shaase <at> iris:~/qq/cython/Demos: python build_ext --inplace
> Compiling primes.pyx because it changed.
> Compiling spam.pyx because it changed.
> Compiling numpy_demo.pyx because it changed.
> running build_ext
> building 'primes' extension
> C compiler: gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2
(Continue reading)