473,486 Members | 1,850 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

import numarray problems

I'm having a problem ........

I've stripped all my code to help isolate the problem.

Its seems to be with importing numarray when python is embedded in C.

I have a simple C program it Opens Python imports a script and
then Closes Python

like so .......

int main(int argc,char *argv[])
{

int count = 0;
PyObject *pmod;

while ( count < 10)
{

/*
** Initialize Python
*/

Py_Initialize();
printf("\nOpen Python ---- >");

pmod = PyImport_ImportModule("test");

Py_DECREF(pmod);

/*
** Close Python
*/

Py_Finalize();
printf("\n<---- Closed Python");
/*
** Do this 10 times !
*/
count++;

}
getchar();
return(0);

}

and thats it !

The script it calls is test.py its very simple , it imports numarray
and then returns. like so .......

-----------------------
test.py
-----------------------
#Imports
from numarray import *

def test_func():
return (99)
-----------------------
end of file
-----------------------
The first time it is called from my C code
it all works fine ! ( but only the first time ! )

In the second iteration above test .c crashes

It has something to do with importing numarray.
Beacase if you comment out the import line i.e

-----------------------
test.py
-----------------------
#Imports
# Commented out !
#from numarray import *

def test_func():
return (99)
-----------------------
end of file
-----------------------

its scrolls through the while loop and works fine.

Its all very odd . any ideas ?
I'm using Python 2.3.3 and Python 2.3 numarray - 0.8

Thanks in advance
Jul 18 '05 #1
0 1138

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1902
by: Tim Rowe | last post by:
Does numarray-0.5.win32-py2.2.exe work with Python 2.3? If not, is there a version that will? Tia, Tim
3
1811
by: Alexander Schwaigkofler | last post by:
Hi! I have the following problem with numarray. I read the install.txt manual, but it doesn't already work. OS: Microsoft Windows 2000 python: Python 2.2.3 (#42, May 30 2003, 18:12:08) on...
4
1960
by: Marco Bubke | last post by:
Hi Ok, I get a reproduceable seqmentation fault. Ok, fist the code: cdef NumArray array_to_double(NumArray array): # maybe here is memoty leak! cdef NumArray flat_array_obj flat_array_obj...
2
2932
by: Marc Schellens | last post by:
Following the NumPy documentation, I took over some C code, but run into an error. Does anybody have a suggestion? Thanks, marc gdlpython.cpp:225: `PyArray_Type' undeclared (first use this...
4
1475
by: Christopher T King | last post by:
In a quest to speed up numarray computations, I tried writing a 'threaded array' class for use on SMP systems that would distribute its workload across the processors. I hit a snag when I found out...
2
1192
by: Sonium | last post by:
Hi, I am new to numarray and I'm going to use it in a nummerical computation of planet and probe orbits. There for I created a body class, representing an gravity affected mass (like a planet or a...
1
1282
by: Jean Moser | last post by:
I tried many times to connect to numarray without success. I choosed the release: numarray-1.1.1.win32py2.2.exe then I went to the setup program made by Greenfield and I tried to follow the...
4
1211
by: A. L. | last post by:
hi, everybody here, I am a newbie to python. I encounter a problem that how to convert an array of numarray to pil object. For example, the data in an image is extracted using Image.getdata,...
10
2209
by: Bryan | last post by:
hi, what is the difference among numeric, numpy and numarray? i'm going to start using matplotlib soon and i'm not sure which one i should use. this page says, "Numarray is a...
0
7094
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3066
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
259
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.