Re: distutils compiler flags for extension modules

2009-03-25 Thread Christian Meesters
Thanks! I'll try that. Sorry for replying so late - just didn't get to it. Christian -- http://mail.python.org/mailman/listinfo/python-list

distutils compiler flags for extension modules

2009-03-20 Thread Christian Meesters
Hoi, as I got no answers with the previous question (subject: disabling compiler flags in distutils), I thought I should ask the question in a different way: Is there an option to set the compiler flags for a C/C++ extension in distutils? There is the extra_compile_args-option in the Extension

disabling compiler flags in distutils

2009-03-13 Thread Christian Meesters
Hoi, I've written an extension in C++ which compiles wonderfully. However, I want to compile it using a setup script with distutils and distutils gives the compiler the unwanted (!) flag "-Wstrict-prototypes", which is a flag only understood when compiling C. The C++ compiler runs, but issues

Re: How to convert image into numpy.ndarray

2009-02-25 Thread Christian Meesters
On Wed, 25 Feb 2009 07:52:03 -0800, anti-suho wrote: > In scipy module, there is a function named misc.lena which can return an > array of numpy.ndarray type. If you use this array as parameter of > matplotlib.pyplot.imshow and then call the matplotlib.pyplot.imshow > function, an image will be sh

Re: glibc detected *** python: corrupted double-linked list

2009-02-25 Thread Christian Meesters
Hi, >> I have a problem using my software on my 64bit laptop, after an update >> of my system. The same code still runs on 32bit Intel, but on my laptop >> I provoke the crash in the title. The crash is caused - as narrowed >> down by me - by returning a static PyObject from a C-extension >> funct

Re: glibc detected *** python: corrupted double-linked list

2009-02-25 Thread Christian Meesters
Thanks David! It's still not debugged, but indeed: I get a bunch of warnings. And this already showed me that there are more potential problems than my first guess indicated. Alas, for my specific problem I cannot work with ints chars and doubles. I need to have unsigned longs at some points.

glibc detected *** python: corrupted double-linked list

2009-02-25 Thread Christian Meesters
Hoi, I have a problem using my software on my 64bit laptop, after an update of my system. The same code still runs on 32bit Intel, but on my laptop I provoke the crash in the title. The crash is caused - as narrowed down by me - by returning a static PyObject from a C-extension function. Well, no

Re: 32 bit or 64 bit?

2008-06-15 Thread Christian Meesters
Peter Otten wrote: > > How did you determine that standard python floats are not good enough? > Everything beyond that is unlikely to be supported by the hardware and > will therefore introduce a speed penalty. > > Did you try gmpy? I would like to add: If Python's precision (or that of additiona

Re: problem with Py_BuildValue

2008-06-15 Thread Christian Meesters
Thank you so much - I was such an idiot (see below). >>> I see nothing wrong with your code so I'd say it is somewhere else (did >>> you snip any code between the end of the loop and the return?). > >>No. (Apart from freeing allocated memory.) > > I'm pretty sure we'll find something interesting

Re: 32 bit or 64 bit?

2008-06-15 Thread Christian Meesters
> I do need speed. Is there an option? Mind telling us what you *actually* want to achieve? (What do you want to calculate?) Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with Py_BuildValue

2008-06-15 Thread Christian Meesters
Thank you. At least I can exclude another few error sources, now. Cédric Lucantis wrote: > I see nothing wrong with your code so I'd say it is somewhere else (did > you snip any code between the end of the loop and the return?). No. (Apart from freeing allocated memory.) > I've never > seen tho

problem with Py_BuildValue

2008-06-15 Thread Christian Meesters
Hi, currently I have a problem understanding Py_BuildValue. I have this code: static PyObject *function(PyObject *self, PyObject *args) { PyObject * python_return_value = NULL; PyObject * dummy = NULL; double * internal_list; /* converting to python representation */ for (i

Re: seg. fault with Py_BuildValue?

2008-05-30 Thread Christian Meesters
Ok now, I know where the error is: "y" actually contained refcounts. This, of course, is complete nonsense and causes the interpreter to crash at some point. Thanks to all of you: You helped at least to track down the problem. Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: seg. fault with Py_BuildValue?

2008-05-30 Thread Christian Meesters
> Check if either x or y are NULL. They aren't. Just did an explicit check. -- http://mail.python.org/mailman/listinfo/python-list

Re: seg. fault with Py_BuildValue?

2008-05-29 Thread Christian Meesters
> What happens if you get rid of the ()? Can't see any difference. -- http://mail.python.org/mailman/listinfo/python-list

seg. fault with Py_BuildValue?

2008-05-29 Thread Christian Meesters
Hi I'm having trouble with Py_BuildValue. I was able to pinpoint the following statement as the one causing a seg. fault with my script: static PyObject * funcname(PyObject *self, PyObject *args) { ... return Py_BuildValue("(OO)", x, y); } where x & y are both of type PyObject. Any suggestions

Re: extending Python - passing nested lists

2008-01-29 Thread Christian Meesters
> You didn't mention speed in your original post. Sorry, perhaps I considered this self-evident - which it is, of course, not. > What about using > array.array? Unless I am mistaken, these are just a thin wrapper > around normal C arrays. The algorithm I want to implement requires several millio

Re: extending Python - passing nested lists

2008-01-29 Thread Christian Meesters
Thanks. Point is that all such approaches would require lots(!) of calls to the Python API - a way by which I won't gain the desired speed. I've tried pyrex and the corresponding C-file is so convoluted with dummy variables, incrementing & decrementing references, and other stuff, that I want to

Re: extending Python - passing nested lists

2008-01-29 Thread Christian Meesters
Think, that I'm still at the wrong track. Point is that I cannot find any examples and don't know where to start here. Perhaps my problem boils down to two questions: I'd like to pass lists (in some cases nested ones) from Python to C and convert those Python-lists to C-arrays (e. g. of doubles). M

Re: extending Python - passing nested lists

2008-01-28 Thread Christian Meesters
Mark Dickinson wrote: > Well, it's pretty clear: you misspelt "length" as "lenght". :) Well, that's not it ;-). (Damn copy & paste plague ...) > > PySequence_Fast doesn't return an array: it returns a PyObject---in > this case, a PyObject corresponding to a Python tuple. That's it. Thanks. Thi

extending Python - passing nested lists

2008-01-28 Thread Christian Meesters
Hi, I would like to write a C-extension function for an application of mine. For this I need to pass a nested list (like: [[a, b, c], [d, e, f], ...], where all letters are floats) to the C-function. Now, with the code I have the compiler is complaining: "subscripted value is neither array nor poi

Re: permuting over nested dicts?

2007-11-01 Thread Christian Meesters
Thanks everyone, I knew there must be a snippet somewhere, just couldn't find one! (Just for the sake of completeness: Order doesn't matter and I hope that with my data I won't reach the recursion depth limit.) Christian -- http://mail.python.org/mailman/listinfo/python-list

permuting over nested dicts?

2007-10-31 Thread Christian Meesters
Hoi, I have the following data structure (of variable size actually, to make things simple, just that one): d = {'a': {'x':[1,2,3], 'y':[4,5,6]}, 'b': {'x':[7,8,9], 'y':[10,11,12]}} This can be read as a dict of possibilities: The entities 'a' and 'b' have the parameters 'x' and 'y', each. An

Re: strange behavious of the logging module?

2007-09-27 Thread Christian Meesters
Thanks Peter and Vinay, I finally understood. And indeed, removing the pyc-file in questions solves the problem - at least temporarily. Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: strange behavious of the logging module?

2007-09-25 Thread Christian Meesters
Peter Otten wrote: > Vinay Sajip wrote: > >> This is a known bug, and not specifically related to logging, though >> it sometimes manifests itself via logging: >> >> http://bugs.python.org/issue1180193 > > Yup, thanks for looking into it. > > Peter Thanks Vinay, but I am curious how issue 1180

problem writing setup script

2007-09-24 Thread Christian Meesters
Hi I have the following file structure MANIFEST README INSTALL -- all text setup.py src/ __init__.py foo.py for_ext.pyx and this setup-script: import sys from distutils.core import setup from distutils.extension import Extension try: from Pyrex.Distutils import build_ext except

Re: strange behavious of the logging module?

2007-09-24 Thread Christian Meesters
Thanks Peter and Gabriel, I see, so I should provide the application with an additional handler for the file in order to gain maximum independence of the two handlers (console & file stream). >> Also, adding %(funcName)-8s to the formatter in basigConfig does not work >> for me: instead of the fu

strange behavious of the logging module?

2007-09-23 Thread Christian Meesters
Hi, having the following code: import logging logging.basicConfig(level=logging.ERROR, format='%(levelname)-8s %(message)s', filename='mc_rigid.log', filemode='w') # define a Handler which writes INFO messages or higher to the sys.stderr

Re: permutations - fast & with low memory consumption?

2006-12-19 Thread Christian Meesters
Thanks Simon & Gerard! I will check those exampels out. Christian PS Of course, I did google - but apparently not creative enough. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is htmlGen still alive?

2006-12-19 Thread Christian Meesters
If starship does not get up anymore (give it a few hours) you might want to have a look here: http://www.python.org/ftp/python/contrib-09-Dec-1999/Network/ Else, I can send you a tarfile of version 2.1, too. As hg said, apart from a few deprecation warnings it's working fine for me (but I'm only u

permutations - fast & with low memory consumption?

2006-12-19 Thread Christian Meesters
Hi, I'd like to hack a function which returns all possible permutations as lists (or tuples) of two from a given list. So far, I came up with this solution, but it turned out to be too slow for the given problem, because the list passed ("atomlist") can be some 1e5 items long: def permute(at

Re: excel in unix?

2006-08-10 Thread Christian Meesters
[EMAIL PROTECTED] wrote: > hi > is it possible to create excel files using python in Unix env? > if so, what module should i use? > thanks You might want to give pyExelerator a try: http://sourceforge.net/projects/pyexcelerator Remark: I had the problem of having a bunch of Data on my Linux machi