Hi
I've a multi-threaded C++ program, in which I want to use embedded
python interpreter for each thread. I am using Python 2.6.2 on Linux
for this.
When I tried to embed python interpreter per thread, I got crash when
the threads were calling Python's C APIs.
Can we not use python interpreters
I have C application in which I have instantiated Python interpreter
in each worker thread.
When I start the program it crashes at different places in Python code
but program never finishes normally.
One such core dump is given below.
Can you please help me in following queries?
1) Can we not us
How can I build a release and not the debug version of libpython.a?
I have seen that there are assert, abort statements in lot many
functions in Python code. I would like to avoid those when compiling
the libpython.a library because when this libpython gets used for
production purpose and it aborts
Regarding PyTuple_New, when I pass this tuple with variable values set
to some evaluation function like PyObject_CallObject, do I need to
increment reference for this tuple & then decrement again after the
call returns?
If I've not configured my libpython with threads when compiling, will
PyGILSta
On Apr 4, 10:27 pm, Andrew Svetlov wrote:
> To destroy every python object you need to call Py_DECREF.
> To call python code fron you C thread you need to use pair
> PyGILState_Ensure/PyGILState_Release.
In my case, my C application has multiple threads & they are accessing
a single Python Interp
I am using PyTuple_New to pass function arguments to
PyObject_CallObject for execution of a Python function.
How can I free up the memory and object allocated by the PyTuple_New
function?
I am using Python interpreter in my multi-threaded C application & at
load condition my application crashes
I've emabedded Python(2.6) in my C++ application and using on Solaris
5.10.
When the application calls Py_Eval, it causes an abort & application
core dumps. But this is at random times & no pattern for this. Crash
is as below:
Can you please help to know, what can cause this abort in PyFrame_New?
I am creating functions, the return result of which I am using to make
decisions in combined expressions.
In some expressions, I would like to inverse the return result of
function.
E.g. function contains(source,search) will return true if "search"
string is found in source string.
I want to make
Yes, that worked. I "protected" the variable which I did not want to
get freed. I incremented reference for that variable & it started
working.
Thanks for all your guidance.
On May 3, 5:23 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
> Python will do nothing with the pointer inside a PyCObj
On Apr 22, 7:54 am, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
>
> If you have a C function that receives a PyCObject, just include the
> relevant headers (cobject.h) and you can retrieve the original pointer
> using PyCObject_AsVoidPtr:
>
> void foo(PyObject *pyobj)
> {
> TOriginalType
On Apr 21, 10:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Mon, 21 Apr 2008 10:24:15 -0300, grbgooglefan <[EMAIL PROTECTED]> escribió:
>
> > I am trying to pass a C++ object to Python function. This Python
> > function then calls ano
I am trying to pass a C++ object to Python function. This Python
function then calls another C++ function which then uses this C++
object to call methods of that object's class.
I tried something like this, but it did not work, gave core dump.
class myclass {
public:
myclass(){};
Hi,
I have a situation that I need to search a name in a big list of names
in my Python embedded interpreter. I am planning to use hash map for
quicker search.
How do I create hash map in Python?
Can you please guide me to some documentation or tutorial which
provides information on creating, editi
On Jan 11, 9:31 am, "Borse, Ganesh" <[EMAIL PROTECTED]>
wrote:
> Hi,
> Can you please guide me for the following problem?
> The call to "PyImport_ImportModule("cStringIO");" is failing with an error of
> "undefined symbol:PyObject_SelfIter".
>
> Before importing this module, I am importing only th
On Jan 10, 6:07 pm, grbgooglefan <[EMAIL PROTECTED]> wrote:
> I am importing cStringIO module in my PythonC++ embedded program.
>
> The import is failing with the following error:
> ImportError: /usr/lib/python2.3/lib-dynload/cStringIO.so: undefined
> symbol:PyObject_SelfI
On Jan 9, 8:01 pm, grbgooglefan <[EMAIL PROTECTED]> wrote:
> On Dec 19 2007, 5:55 pm, Christian Heimes <[EMAIL PROTECTED]> wrote:
> >grbgooglefanwrote:
> > > PythonC API functionPyErr_Print( ) prints an error string onto stderr
> > > if PyErr_Occurred() is tr
On Jan 30, 1:58 pm, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> On 30 ene, 01:58, grbgooglefan <[EMAIL PROTECTED]> wrote:
>
> > How do I pass the elements populated in struct variables of this
> > vector dynamically to PyEval_CallFunction, in the f
Hello Python Experts
May you please help me on this change?
I have following code:
//==
typedef struct IOParams {
char *ioString;
long lionum;
double dionum;
float fionum;
intnionum;
} *pIOParams;
//
On Jan 15, 5:45 pm, grbgooglefan <[EMAIL PROTECTED]> wrote:
> I am in a perculiar situation. I want to use PyRun_SimpleString for
> creating Python functions in embedded Python in C++.
> But there could be cases when Python function code compilation could
> fail & PyRun_Simpl
I am in a perculiar situation. I want to use PyRun_SimpleString for
creating Python functions in embedded Python in C++.
But there could be cases when Python function code compilation could
fail & PyRun_SimpleString will return -1 as return status. At this
time, it prints the error message to sys.s
I am importing cStringIO module in my PythonC++ embedded program.
The import is failing with the following error:
ImportError: /usr/lib/python2.3/lib-dynload/cStringIO.so: undefined
symbol: PyObject_SelfIter
I have python-2.3.3-88.9.x86 installed on my machine.
Why is this error coming? how can I
On Dec 19 2007, 5:55 pm, Christian Heimes <[EMAIL PROTECTED]> wrote:
> grbgooglefan wrote:
> > PythonC API functionPyErr_Print( ) prints an error string onto stderr
> > if PyErr_Occurred() is true.
> > I don't want to print this to stderr because my Python+C code is
I have embedded Python in my C++ application & creating Python
function from the expression. I am then evaluating those Python
compiled function (byte code) using PyObject_CallObject.
I want to create a Python module which will have functions called by
my user defined functions from the embedded P
On Jan 3, 8:49 pm, grbgooglefan <[EMAIL PROTECTED]> wrote:
> On Jan 3, 8:02 pm, Phil Thompson <[EMAIL PROTECTED]>
> wrote:
>
>
>
>
>
> > On Thursday 03 January 2008, grbgooglefan wrote:
>
> > > I have a following C++ code which uses PyObject_C
On Jan 3, 8:02 pm, Phil Thompson <[EMAIL PROTECTED]>
wrote:
> On Thursday 03 January 2008, grbgooglefan wrote:
>
> > I have a following C++ code which uses PyObject_CallObject to evaluate
> > expressions dynamically. This code sets the input parameters for the
> > fu
I have a following C++ code which uses PyObject_CallObject to evaluate
expressions dynamically. This code sets the input parameters for the
function also dynamically. After calling this function 4 times (with
these shown values), PyObject_CallObject causes application to crash
in frame_dealloc.
1)
PythonC API function PyErr_Print( ) prints an error string onto stderr
if PyErr_Occurred() is true.
I don't want to print this to stderr because my Python+C code is
running daemon mode & won't have terminal / stderr.
So, I want to retrieve the string which PyErr_Print( ) will print.
E.g., PyErr_Pri
I am having a object tuple created at application startup. This tuple
I pass on to a python function in call to:
PyObject_CallObject(pcatInfo->pPyEvalFunction,pTuple);
For setting the values in this tuple, I am using PyLong_FromLong,
PyString_FromString & friends functions.
PyTuple_SetItem(pTu
On Dec 7, 5:15 pm, Christian Heimes <[EMAIL PROTECTED]> wrote:
> grbgooglefan wrote:
> > I am compiling CPP program which uses CPython API functions from
> > Python 2.5.1 source code
>
> > First I compiled with this commanline, that time I got "pyconfig.h"
On Dec 7, 2:17 pm, grbgooglefan <[EMAIL PROTECTED]> wrote:
> On Dec 7, 12:32 pm, grbgooglefan <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > I am compiling CPP program which uses CPython API functions from
> > Python 2.5.1 source code
>
> > Fir
On Dec 7, 3:07 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
> En Fri, 07 Dec 2007 01:24:57 -0300, grbgooglefan <[EMAIL PROTECTED]>
> escribió:
>
>
>
>
>
> > On Dec 7, 12:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
> &g
On Dec 7, 2:01 pm, DavidM <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm embedding python in a C prog which is built as a linux shared lib.
>
> The prog is linked against libpython, and on startup, it calls
> Py_Initialize().
>
> The prog imports a pure-python script. The script starts up ok, but whe
On Dec 7, 12:32 pm, grbgooglefan <[EMAIL PROTECTED]> wrote:
> I am compiling CPP program which uses CPython API functions from
> Python 2.5.1 source code
>
> First I compiled with this commanline, that time I got "pyconfig.h"
> not found.
> g++ -Os -I../../Inc
I am compiling CPP program which uses CPython API functions from
Python 2.5.1 source code
First I compiled with this commanline, that time I got "pyconfig.h"
not found.
g++ -Os -I../../Include ../../libpython2.5.a -lm -ldl -lpthread -lutil
testeval.cpp
In file included from testeval.cpp:1:
../../I
On Dec 7, 12:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Thu, 06 Dec 2007 23:27:15 -0300, grbgooglefan <[EMAIL PROTECTED]>
> escribió:
>
> > I want to use Python's Windows (python25.dll) version to embed in my
> > C# (or atleast V
I want to use Python's Windows (python25.dll) version to embed in my
C# (or atleast VC++) program for performing syntax checks on the
Python expressions which are later supposed to be evaluated at runtime
by another C++ program
For this, I would like to use CPython API functions such as
Py_Initial
On Dec 4, 12:36 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Tue, 04 Dec 2007 00:54:57 -0300, Borse, Ganesh
> <[EMAIL PROTECTED]> escribió:
>
> > When we compile a Python code using functions such as Py_CompileString
> > or any other similar compile function, what will be the resulti
On Nov 16, 7:11 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> "Borse, Ganesh" <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]
> | Py_CompileString takes the sourcecodefrom file, isn't it?
>
> No.
>
> | As can be seen from the syntax of thisfunction: "PyObject*
> Py_CompileString(ch
I want to compile following type of python function in my C++ program
at runtime.
def isSizeSmall(size,vol,ADV,prod):
if ( (size < 1000) & (vol < (0.001 * ADV)) & (prod=="Stock")):
print "OK"; return 10
else: print "NOK"; return 11
Using Py_CompileString, I compiled a code object from this f
39 matches
Mail list logo