Re: how avoid delay while returning from C-python api?

2014-05-30 Thread Lakshmipathi.G
Yes, Cython looks easier but the problem its a very old code ( 6 or 7 years ). Almost entire code base uses plain python-c api. Thanks for the example, will use Cython or Ctypes way for side-projects! Cheers, Lakshmipathi.G FOSS Programmer. www.giis.co.in/readme.html -- https://mail.pytho

Re: how avoid delay while returning from C-python api?

2014-05-28 Thread Stefan Behnel
Lakshmipathi.G, 28.05.2014 12:22: > I have C-Python api like below. It works fine, but the problem is > while invoking this method > from python script say > > #cat script.py > > offset=0 > size=4 > write_object(offset,size) > > > > This calls write_thi

Re: how avoid delay while returning from C-python api?

2014-05-28 Thread Lakshmipathi.G
The statement "after call" printed to stdout and the script waits there for few seconds. So I was assuming something delaying the return value. Just found out there is core-dump "segmentation fault (core dumped) python" ..Probably fixing core dump should resolve the issue. Thanks! Cheers, La

Re: how avoid delay while returning from C-python api?

2014-05-28 Thread Ned Batchelder
On 5/28/14 6:22 AM, Lakshmipathi.G wrote: Hi - I have C-Python api like below. It works fine, but the problem is while invoking this method from python script say #cat script.py offset=0 size=4 write_object(offset,size) This calls write_this_c() C api and returns quickly to next printf

how avoid delay while returning from C-python api?

2014-05-28 Thread Lakshmipathi.G
Hi - I have C-Python api like below. It works fine, but the problem is while invoking this method from python script say #cat script.py offset=0 size=4 write_object(offset,size) This calls write_this_c() C api and returns quickly to next printf statement. But the return call (Py_RETURN_NONE

Re: C++ - Python API

2010-09-19 Thread Aahz
In article , Thomas Jollans wrote: >On Sunday 19 September 2010, it occurred to Aahz to exclaim: >> In article , >> Thomas Jollans wrote: >>>On Wednesday 01 September 2010, it occurred to Markus Kraus to exclaim: So the feature overview: >>> >>>First, the obligatory things you don't w

Re: C++ - Python API

2010-09-19 Thread Thomas Jollans
On Sunday 19 September 2010, it occurred to Aahz to exclaim: > In article , > > Thomas Jollans wrote: > >On Wednesday 01 September 2010, it occurred to Markus Kraus to exclaim: > >> So the feature overview: > >First, the obligatory things you don't want to hear: Have you had > >a look at similar

Re: C++ - Python API

2010-09-19 Thread Aahz
In article , Thomas Jollans wrote: >On Wednesday 01 September 2010, it occurred to Markus Kraus to exclaim: >> >> So the feature overview: > >First, the obligatory things you don't want to hear: Have you had >a look at similar efforts? A while ago, Aahz posted something very >similar on this very

Re: C++ - Python API

2010-09-01 Thread Markus Kraus
Thanks for the answer On 1 Sep., 22:29, Thomas Jollans wrote: > On Wednesday 01 September 2010, it occurred to Markus Kraus to exclaim: > > > So the feature overview: > > First, the obligatory things you don't want to hear: Have you had a look at > similar efforts? A while ago, Aahz posted someth

Re: C++ - Python API

2010-09-01 Thread Thomas Jollans
On Wednesday 01 September 2010, it occurred to Markus Kraus to exclaim: > So the feature overview: First, the obligatory things you don't want to hear: Have you had a look at similar efforts? A while ago, Aahz posted something very similar on this very list. You should be able to find it in any

C++ - Python API

2010-09-01 Thread Markus Kraus
Hi guys i worked on this for severl days (or even weeks?!) now, but im nearly finished with it: A complete C++ to Python API which allows you to use python as a scripting language for your C++ projects. Simple example: --- python code --- def greet( player ): print( "Hello player " + player.get

Re: Let python call a C function pointer passed from the C Python API

2009-11-16 Thread sturlamolden
On 16 Nov, 14:25, Carl Banks wrote: > Python can't call C function pointers.   Yes it can, use ctypes... -- http://mail.python.org/mailman/listinfo/python-list

Re: Let python call a C function pointer passed from the C Python API

2009-11-16 Thread Carl Banks
On Nov 16, 5:04 am, hvictor wrote: > I have C++ a void function pointer stored in a variable call. The > pointed function takes an int and a char* as arguments. > > I have a python module containing this function: > > def yeah(x): >         x(int(0),"text argument") >         return "pointer calle

Let python call a C function pointer passed from the C Python API

2009-11-16 Thread hvictor
I have C++ a void function pointer stored in a variable call. The pointed function takes an int and a char* as arguments. I have a python module containing this function: def yeah(x): x(int(0),"text argument") return "pointer called" As you can see I'm trying to use the argument

C-Python API problem

2009-01-27 Thread Rajorshi Biswas
Hi, I was trying out the sample program to load a python script from C in the Python tutorial at http://docs.python.org/extending/embedding.html (Section: Pure Embedding).Usage: call pythonfile funcname [args] When running this script, I can run things like the following:call mytest foobut not a

simplest c python api callback example

2008-06-26 Thread Tim Spens
The following is a simple complete example using the c python api to generate callbacks from c to python. But when I run the c code I get a segfault in PyInt_FromLong () (see below). Most of this example code was taken from pg 1478 of the 3rd edition python o'reilly book. I cannot see

Re: C++ version of the C Python API?

2007-10-23 Thread Martin Marcher
2007/10/21, Robert Dailey <[EMAIL PROTECTED]>: > On 10/21/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > No, I literally meant that the Python C API is object-oriented. > > You don't need an object-oriented language to write object-oriented > > code. > > I disagree with this statement. C is n

Re: C++ version of the C Python API?

2007-10-22 Thread Martin v. Löwis
> This preference, in > turn, is what motivated my original question. The CPython API > interface itself seems modularized, NOT object oriented (only from > what I saw). I suggest you look again, then. Things like PyObject_String, PyObject_GetAttrString, or PySequence_GetItem all express the obje

Re: C++ version of the C Python API?

2007-10-22 Thread Robert Dailey
On 10/22/07, Nicholas Bastin <[EMAIL PROTECTED]> wrote: > > Object-oriented programming is a design choice, not a language > feature. You can write straight procedural code in C++, and you can > write object oriented code in C. Sure, C++ has some language features > which facilitate object-orient

Re: C++ version of the C Python API?

2007-10-21 Thread Nicholas Bastin
On 10/21/07, Robert Dailey <[EMAIL PROTECTED]> wrote: > On 10/21/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > No, I literally meant that the Python C API is object-oriented. > > You don't need an object-oriented language to write object-oriented > > code. > > I disagree with this statement.

Re: C++ version of the C Python API?

2007-10-21 Thread Nicholas Bastin
On 10/21/07, Carl Banks <[EMAIL PROTECTED]> wrote: > Now, a C++ API for CPython would necessarily be built on top of the C > API, which carries some limitations relative to the OOP abilities of C++ > itself. It wouldn't have to be, although it'd be much more of a maintenance nightmare if it poked

Re: C++ version of the C Python API?

2007-10-21 Thread Aahz
In article <[EMAIL PROTECTED]>, Robert Dailey <[EMAIL PROTECTED]> wrote: > >Is there a C++ version of the C Python API packaged with python 2.5? >It would be nice to have a OOP approach to embedding python in C++. It >would also be a bonus if this C++ Python API cleaned up

Re: C++ version of the C Python API?

2007-10-21 Thread Michael L Torrie
Robert Dailey wrote: > On 10/21/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >> No, I literally meant that the Python C API is object-oriented. >> You don't need an object-oriented language to write object-oriented >> code. > > I disagree with this statement. C is not an object oriented langua

Re: C++ version of the C Python API?

2007-10-21 Thread Carl Banks
On Sun, 21 Oct 2007 16:17:19 -0500, Robert Dailey wrote: > On 10/21/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >> No, I literally meant that the Python C API is object-oriented. You >> don't need an object-oriented language to write object-oriented code. > > I disagree with this statement. C

Re: C++ version of the C Python API?

2007-10-21 Thread Alex Martelli
"Martin v. Löwis" <[EMAIL PROTECTED]> wrote: ... > The most popular ones are Boost.Python, CXX, and PySTL. I think SIP is also pretty popular (see ). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: C++ version of the C Python API?

2007-10-21 Thread Robert Dailey
On 10/21/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > No, I literally meant that the Python C API is object-oriented. > You don't need an object-oriented language to write object-oriented > code. I disagree with this statement. C is not an object oriented language, and I've seen attempts to

Re: C++ version of the C Python API?

2007-10-21 Thread Martin v. Löwis
> Could you emphasize a little more? I haven't worked much at all with > the Python C API, so I may be misunderstanding. First of all, you say > that the "Python C API is object oriented", which is contradictory > because it should read "Python C++ API is object oriented". Perhaps > this is a typo,

Re: C++ version of the C Python API?

2007-10-21 Thread Robert Dailey
On 10/21/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > I think you are misinterpreting what you are seeing. The Python C API > *is* object-oriented. It has all features of object-orientation: > classes, encapsulation, polymorphism, late binding, ... > > As for "make your own": people have trie

Re: C++ version of the C Python API?

2007-10-21 Thread Martin v. Löwis
> Well C++ implicitly includes OOP since that is the foundation of the > language. I was more or less asking if there was an object oriented > version of the Python embedded API or perhaps an OO wrapper. However > it doesn't seem that way, so I may have to make my own. I think you are misinterpret

Re: C++ version of the C Python API?

2007-10-21 Thread Robert Dailey
On 10/21/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > Is there a C++ version of the C Python API packaged with python 2.5? > > Stargaming has already mentioned the fine points; the first answer is: > yes, the API packaged python 2.5 can be used with C++. It

Re: C++ version of the C Python API?

2007-10-21 Thread Martin v. Löwis
> Is there a C++ version of the C Python API packaged with python 2.5? Stargaming has already mentioned the fine points; the first answer is: yes, the API packaged python 2.5 can be used with C++. It is a C++ version of the same API as it adds proper extern "C" declarations around a

Re: C++ version of the C Python API?

2007-10-19 Thread Stargaming
On Fri, 19 Oct 2007 17:37:29 -0500, Robert Dailey wrote: > Hi, > > Is there a C++ version of the C Python API packaged with python 2.5? It > would be nice to have a OOP approach to embedding python in C++. It > would also be a bonus if this C++ Python API cleaned up a lot of t

Re: C++ version of the C Python API?

2007-10-19 Thread Joe Riopel
On 10/19/07, Robert Dailey <[EMAIL PROTECTED]> wrote: > Is there a C++ version of the C Python API packaged with python 2.5? > It would be nice to have a OOP approach to embedding python in C++. It > would also be a bonus if this C++ Python API cleaned up a lot of the > mess

C++ version of the C Python API?

2007-10-19 Thread Robert Dailey
Hi, Is there a C++ version of the C Python API packaged with python 2.5? It would be nice to have a OOP approach to embedding python in C++. It would also be a bonus if this C++ Python API cleaned up a lot of the messy code involved in embedding python. Thanks. -- http://mail.python.org/mailman