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 the sys module.
Py_SetProgramName("/usr/bin/python");
Py_Initialize(
When we compile a Python code using functions such as Py_CompileString or any
other similar compile function, what will be the resulting executable code?
Will it be byte code somewhat like the byte code of Java?
Or it will be the same binary code like the once generated by C/C++ compilers
from th
--Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 22 November 2007 15:07
To: Borse, Ganesh
Cc: python-list@python.org
Subject: Please help in creating Python function in C ++ program
Forwarded to python-list@python.org
--- "Borse, Ganesh" <[EMAIL PROTECTED]>
I want to call Python function which takes input arguments (parameters) from
C++ program on the fly when program is running, as below:
def isSizeSmall(size,vol,ADV,prod):
if ( (size < 1000) & (vol < (0.001 * ADV)) & (prod=="Stock")): return 100
else: return 11
I tried following approach
> Can we not use the "PyObject*" returned by Py_CompileString as input to
> PyObject_GetAttrString?
> What could be wrong?
>>>per documentation
>>>compile string returns None when you use Py_file_input
This is not true. I am getting a valid code object returned when I am using
"" & Py_file_input.
Hi,
My following code is failing with an error of "isSizeSmall not function or
callable"
//---
char szExpr[2048];
memset(szExpr,'\0',sizeof(szExpr));
sprintf(szExpr,"def isSizeSmall(size,vol,ADV,prod):\n if ( (size < 1000) &
(vol < (0.001 * ADV))
Hi,
May you please help in using Py_CompileString & PyEval_EvalCode to
parse+compile an expression at startup & evaluate that multiple times at
runtime.
I want to use this in C++ program as below.
Here, the expression contains the variables like size, vol, ADV, etc. The
values of these variable
Thanks this is helpful.
-Original Message-
From: Gabriel Genellina [mailto:[EMAIL PROTECTED]
Sent: 15 November 2007 12:26
To: python-list@python.org
Subject: Re: How to evaluate the code object returned by PyParser_SimplePa
rseString function?
En Wed, 14 Nov 2007 23:20:14 -0300, Borse
Thanks for this.
>>Terry>>Compile the string into a code object. Code objects can be executed by
>>an exec statement or evaluated by a call to eval().
Can I call exec() or eval() as is from C or C++ program?
What the equivalent calls for this in Python-C API?
That's what I want to know.
Regards
er 2007 07:51
To: python-list@python.org
Subject: Re: How to use the evaluate the code object returned by PyParser_Simp
leParseString function?
En Wed, 14 Nov 2007 06:48:41 -0300, Borse, Ganesh <[EMAIL PROTECTED]> escribió:
> `struct _node* PyParser_SimpleParseString(char *str, int start)
ROTECTED]
Sent: 15 November 2007 07:51
To: python-list@python.org
Subject: Re: How to use the evaluate the code object returned by PyParser_Simp
leParseString function?
En Wed, 14 Nov 2007 06:48:41 -0300, Borse, Ganesh <[EMAIL PROTECTED]> escribió:
> `struct _node* PyParser_SimplePars
Hi,
Can someone please help me in the following question?
On the web page
http://olympus.het.brown.edu/cgi-bin/info2www?(python2.3-api)Very+High+Level+Layer,
I got the following information:
`struct _node* PyParser_SimpleParseString(char *str, int start)'
Parse Python source code from STR
erand
>>>
>>> if smallone in bigstring:
...print 'ok'
... else:
... print 'nok'
...
Traceback (most recent call last):
File "", line 1, in ?
TypeError: 'in ' requires character as left operand
Do I need to import any module?
Thanks,
Ga
Hi,
Am new to python.
May someone please help me know this?
How can we check whether one big string contains another small string?
E.g.
bigstring="python anaconda boa cobra"
smallone="boa"
If 0 == contains(bigstring,smallone):
print "Yes, boa is snake.."
Is there any function like "co
14 matches
Mail list logo