Re: [Numpy-discussion] Determine if numpy is installed from an extension

2010-02-03 Thread Peter Notebaert
Ah, that is maybe the idea: if (_import_array() < 0) { /* Clear the error state since we are handling the error. */ PyErr_Clear(); /* ... set up for the sans-numpy case. */ } else { /* ... set up for the with-numpy case. */ } I did not call PyErr_Clear() when _import_array() < 0 and t

Re: [Numpy-discussion] Determine if numpy is installed from an extension

2010-02-03 Thread Robert Kern
On Wed, Feb 3, 2010 at 03:41, David Cournapeau wrote: > On Wed, Feb 3, 2010 at 5:38 PM, Peter Notebaert wrote: >> >From an extension? How to import numpy from there and then test if that >> succeeded and that without any annoying message if possible... > > One obvious solution would be to simply

Re: [Numpy-discussion] Determine if numpy is installed from an extension

2010-02-03 Thread David Cournapeau
On Wed, Feb 3, 2010 at 5:38 PM, Peter Notebaert wrote: > >From an extension? How to import numpy from there and then test if that > succeeded and that without any annoying message if possible... One obvious solution would be to simply call PyImport_Import, something like: #include PyMODINIT_FU

Re: [Numpy-discussion] Determine if numpy is installed from an extension

2010-02-03 Thread Peter Notebaert
>From an extension? How to import numpy from there and then test if that succeeded and that without any annoying message if possible... Thanks, Peter On Wed, Feb 3, 2010 at 1:34 AM, David Cournapeau wrote: > Peter Notebaert wrote: > > > How can I test if numpy is installed on the system from th

Re: [Numpy-discussion] Determine if numpy is installed from an extension

2010-02-02 Thread David Cournapeau
Peter Notebaert wrote: > How can I test if numpy is installed on the system from the extension so > that I do not active the numpy functionality and that it is still able > to use my extension, but then without numpy support? Is there some reason why you cannot try to import numpy first to chec