Re: Extending Python Questions .....

2009-02-26 Thread Nick Craig-Wood
Ben wrote: > On Feb 24, 11:31?am, Nick Craig-Wood wrote: > > So do you want to embed python into your code? > > > > I'm still not clear what you are trying to achieve with python, though > > I have a better idea what SLAG is now! > > Actually no, I want to EXTEND python using the lower levels

Re: Extending Python Questions .....

2009-02-25 Thread Ben
On Feb 24, 11:31 am, Nick Craig-Wood wrote: > Ben wrote: > >  No, It uses the the S-lang for video, and input control. However, SLAG > >  is more of an abstract layer on top of that. > > >  It has a Structures that contains menus and screens (menumodule / > >  screenmodule). One LOADS them up wit

Re: Extending Python Questions .....

2009-02-24 Thread Mike Driscoll
On Feb 24, 11:31 am, Nick Craig-Wood wrote: > Ben wrote: > >  No, It uses the the S-lang for video, and input control. However, SLAG > >  is more of an abstract layer on top of that. > > >  It has a Structures that contains menus and screens (menumodule / > >  screenmodule). One LOADS them up wit

Re: Extending Python Questions .....

2009-02-24 Thread Nick Craig-Wood
Ben wrote: > No, It uses the the S-lang for video, and input control. However, SLAG > is more of an abstract layer on top of that. > > It has a Structures that contains menus and screens (menumodule / > screenmodule). One LOADS them up with parameters. such as creating > a new menu is like:

Re: Extending Python Questions .....

2009-02-24 Thread Ben
On Feb 23, 2:31 pm, Nick Craig-Wood wrote: > Ben wrote: > >  In My S-Lag Project called, SLAG, I have some function keys that get > >  mapped back to S-lang internal functions. > > >  My SLAG project works pretty much like Python (as does the S-Lang). > >  You write a S-lang script > >  that "imp

Re: Extending Python Questions .....

2009-02-23 Thread Nick Craig-Wood
Ben wrote: > In My S-Lag Project called, SLAG, I have some function keys that get > mapped back to S-lang internal functions. > > My SLAG project works pretty much like Python (as does the S-Lang). > You write a S-lang script > that "imports" your extension. module - and all this gets run by

Re: Extending Python Questions .....

2009-02-23 Thread Diez B. Roggisch
Ben schrieb: Ok... Now I can start asking. In My S-Lag Project called, SLAG, I have some function keys that get mapped back to S-lang internal functions. My SLAG project works pretty much like Python (as does the S-Lang). You write a S-lang script that "imports" your extension. module - and all

Re: Extending Python with C or C++

2009-01-09 Thread Nick Craig-Wood
Thomas Heller wrote: > Nick Craig-Wood schrieb: > > Thomas Heller wrote: > >> Nick Craig-Wood schrieb: > >> > Interesting - I didn't know about h2xml and xml2py before and I've > >> > done lots of ctypes wrapping! Something to help with the initial > >> > drudge work of converting the structur

Re: Extending Python with C or C++

2009-01-08 Thread Thomas Heller
Nick Craig-Wood schrieb: > Thomas Heller wrote: >> Nick Craig-Wood schrieb: >> > Interesting - I didn't know about h2xml and xml2py before and I've >> > done lots of ctypes wrapping! Something to help with the initial >> > drudge work of converting the structures would be very helpful. >> > >>

Re: Extending Python with C or C++

2009-01-07 Thread Nick Craig-Wood
Thomas Heller wrote: > Nick Craig-Wood schrieb: > > Interesting - I didn't know about h2xml and xml2py before and I've > > done lots of ctypes wrapping! Something to help with the initial > > drudge work of converting the structures would be very helpful. > > > > ( http://pypi.python.org/pypi/c

Re: Extending Python with C or C++

2009-01-07 Thread Thomas Heller
Nick Craig-Wood schrieb: > Ralf Schoenian wrote: >> Ryan wrote: >> > I've been using Python for many years now. It's a wonderful language >> > that I enjoy using everyday. I'm now interested in getting to know >> > more about the guts (C/C++) and extending it. But, extending python >> > still see

Re: Extending Python with C or C++

2009-01-06 Thread sturlamolden
On Jan 5, 9:06 pm, Ryan wrote: > I've been using Python for many years now. It's a wonderful language > that I enjoy using everyday. I'm now interested in getting to know > more about the guts (C/C++) and extending it. But, extending python > still seems like a black art to me. There are severa

Re: Extending Python with C or C++

2009-01-06 Thread Nick Craig-Wood
Ralf Schoenian wrote: > Ryan wrote: > > I've been using Python for many years now. It's a wonderful language > > that I enjoy using everyday. I'm now interested in getting to know > > more about the guts (C/C++) and extending it. But, extending python > > still seems like a black art to me. Is th

Re: Extending Python with C or C++

2009-01-06 Thread Stefan Behnel
Ryan wrote: > 3. Extending CPython by connecting it to Python-oblivious code written > in C with Ctypes (Ralf's suggestion is good for this) > 4. Extending CPython by connecting it to Python-aware (and specific) > code using the CPython C-API functions (http://docs.python.org/c-api/) For extending

Re: Extending Python with C or C++

2009-01-05 Thread Ryan
On Jan 5, 2:37 pm, Terry Reedy wrote: > Ryan wrote: > > I've been using Python for many years now. It's a wonderful language > > that I enjoy using everyday. I'm now interested in getting to know > > more about the guts > > The 'guts' of Python the language include the object model, namespaces > (

Re: Extending Python with C or C++

2009-01-05 Thread Terry Reedy
Ryan wrote: I've been using Python for many years now. It's a wonderful language that I enjoy using everyday. I'm now interested in getting to know more about the guts The 'guts' of Python the language include the object model, namespaces (including modules), and the statement and infix-expres

Re: Extending Python with C or C++

2009-01-05 Thread Ralf Schoenian
Ryan wrote: I've been using Python for many years now. It's a wonderful language that I enjoy using everyday. I'm now interested in getting to know more about the guts (C/C++) and extending it. But, extending python still seems like a black art to me. Is there anymore docs or info on extending it

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread John Machin
On Jun 20, 5:56 am, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] nomine.org> wrote: > -On [20080619 17:11], Spectrum ([EMAIL PROTECTED]) wrote: > > > ImportError: dynamic module does not define init function > > Might be it's looking, but not finding, something like crti.S or the likes, > the

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread André Malo
* Jeroen Ruigrok van der Werven wrote: > -On [20080619 17:11], Spectrum ([EMAIL PROTECTED]) wrote: >> ImportError: dynamic module does not define init function > > Might be it's looking, but not finding, something like crti.S or the > likes, the C runtime files that specify stuff like _init and

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread Jeroen Ruigrok van der Werven
-On [20080619 17:11], Spectrum ([EMAIL PROTECTED]) wrote: > ImportError: dynamic module does not define init function Might be it's looking, but not finding, something like crti.S or the likes, the C runtime files that specify stuff like _init and _fini. -- Jeroen Ruigrok van der Werven / asmo

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread Spectrum
On Jun 19, 4:39 pm, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] nomine.org> wrote: > -On [20080619 16:21], Spectrum ([EMAIL PROTECTED]) wrote: > > >          libmpi.so.0 => /usr/lib/openmpi/1.2.4-gcc/libmpi.so.0 > >(0x0042f000) > >          libopen-rte.so.0 => /usr/lib/openmpi/1.2.4-gcc/libope

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread Jeroen Ruigrok van der Werven
-On [20080619 16:21], Spectrum ([EMAIL PROTECTED]) wrote: > libmpi.so.0 => /usr/lib/openmpi/1.2.4-gcc/libmpi.so.0 >(0x0042f000) > libopen-rte.so.0 => /usr/lib/openmpi/1.2.4-gcc/libopen- >rte.so.0 (0x003d4000) > libopen-pal.so.0 => /usr/lib/openmpi/1.2.4-gcc/libopen- >pal.

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread Spectrum
On Jun 19, 2:10 pm, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] nomine.org> wrote: > -On [20080619 13:53], Spectrum ([EMAIL PROTECTED]) wrote: > > >  ImportError: /big/School/Cluster/Opgave03/ctest.so: undefined > >symbol: ompi_mpi_comm_world > > [EMAIL PROTECTED] Opgave03]$ > > >  Can anyone

Re: Extending Python with C: Cannot find MPI library

2008-06-19 Thread Jeroen Ruigrok van der Werven
-On [20080619 13:53], Spectrum ([EMAIL PROTECTED]) wrote: > ImportError: /big/School/Cluster/Opgave03/ctest.so: undefined >symbol: ompi_mpi_comm_world > [EMAIL PROTECTED] Opgave03]$ > > Can anyone suggest anything? Can I get MPI to work in Python? Sounds like a typical case of not specifying an

Re: Extending Python with C: Can I specify another C compiler?

2008-06-04 Thread Ivan Illarionov
On Wed, 04 Jun 2008 09:12:18 -0700, spectrumdt wrote: > Hello. > > I am trying to extend my Python program with some C code. > > This thread is sort of a follow-up to another thread of mine, linked > below. I don't know what the conventions are in this newsgroup about > creating new threads

Re: Extending Python with C: Can I specify another C compiler?

2008-06-04 Thread Ivan Illarionov
On Wed, 04 Jun 2008 09:12:18 -0700, spectrumdt wrote: > Hello. > > I am trying to extend my Python program with some C code. > > This thread is sort of a follow-up to another thread of mine, linked > below. I don't know what the conventions are in this newsgroup about > creating new threads

Re: Extending Python with C: Can I specify another C compiler?

2008-06-04 Thread Ivan Illarionov
On Wed, 04 Jun 2008 09:12:18 -0700, spectrumdt wrote: > Hello. > > I am trying to extend my Python program with some C code. > > This thread is sort of a follow-up to another thread of mine, linked > below. I don't know what the conventions are in this newsgroup about > creating new threads

Re: Extending Python with C: Can I specify another C compiler?

2008-06-04 Thread spectrumdt
On Jun 4, 6:25 pm, Gerhard Häring <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >   Hello. > > >   I am trying to extend my Python program with some C code. [...] > >   Anyway, my question is this: When compiling my C code to include in > > Python, using a Python script with the function

Re: Extending Python with C: Can I specify another C compiler?

2008-06-04 Thread Gerhard Häring
[EMAIL PROTECTED] wrote: Hello. I am trying to extend my Python program with some C code. [...] Anyway, my question is this: When compiling my C code to include in Python, using a Python script with the function distutils.core.setup... can I choose which C compiler to use? On my system it

Re: extending python with array functions

2008-02-05 Thread Janwillem
Gabriel Genellina wrote: > En Tue, 05 Feb 2008 05:28:33 -0200, Marc 'BlackJack' Rintsch > <[EMAIL PROTECTED]> escribi�: > >> On Mon, 04 Feb 2008 20:56:02 -0200, Gabriel Genellina wrote: >> >>> - the array module http://docs.python.org/lib/module-array.html provides >>> homogeneuos arrays that may

Re: extending python with array functions

2008-02-05 Thread Gabriel Genellina
En Tue, 05 Feb 2008 05:28:33 -0200, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> escribi�: > On Mon, 04 Feb 2008 20:56:02 -0200, Gabriel Genellina wrote: > >> - the array module http://docs.python.org/lib/module-array.html provides >> homogeneuos arrays that may be more efficient for your applic

Re: extending python with array functions

2008-02-04 Thread Marc 'BlackJack' Rintsch
On Mon, 04 Feb 2008 20:56:02 -0200, Gabriel Genellina wrote: > - the array module http://docs.python.org/lib/module-array.html provides > homogeneuos arrays that may be more efficient for your application. arrays > don't have a special API, you have to import the module and use its > functio

Re: extending python with array functions

2008-02-04 Thread Gabriel Genellina
En Mon, 04 Feb 2008 18:44:42 -0200, Janwillem <[EMAIL PROTECTED]> escribió: > I want to make numerical functions that can be called from python. > I am programming in pascal the last few decades so I had a look at > "python for delphi" (P4D). The demo09 gives as example add(a,b) using > integer

Re: extending Python - passing nested lists

2008-01-29 Thread Arnaud Delobelle
On Jan 29, 4:00 pm, Christian Meesters <[EMAIL PROTECTED]> wrote: > > You didn't mention speed in your original post. > > Sorry, perhaps I considered this self-evident - which it is, of course, not. > > > What about using > > array.array?  Unless I am mistaken, these are just a thin wrapper > > aro

Re: extending Python - passing nested lists

2008-01-29 Thread Mel
Christian Meesters wrote: >> You didn't mention speed in your original post. > Sorry, perhaps I considered this self-evident - which it is, of course, not. > >> What about using >> array.array? Unless I am mistaken, these are just a thin wrapper >> around normal C arrays. > The algorithm I want

Re: extending Python - passing nested lists

2008-01-29 Thread Christian Meesters
> You didn't mention speed in your original post. Sorry, perhaps I considered this self-evident - which it is, of course, not. > What about using > array.array? Unless I am mistaken, these are just a thin wrapper > around normal C arrays. The algorithm I want to implement requires several millio

Re: extending Python - passing nested lists

2008-01-29 Thread Arnaud Delobelle
On Jan 29, 1:22 pm, Christian Meesters <[EMAIL PROTECTED]> wrote: > Thanks. Point is that all such approaches would require lots(!) of calls to > the Python API - a way by which I won't gain the desired speed. You didn't mention speed in your original post. What about using array.array? Unless I

Re: extending Python - passing nested lists

2008-01-29 Thread Christian Meesters
Thanks. Point is that all such approaches would require lots(!) of calls to the Python API - a way by which I won't gain the desired speed. I've tried pyrex and the corresponding C-file is so convoluted with dummy variables, incrementing & decrementing references, and other stuff, that I want to

Re: extending Python - passing nested lists

2008-01-29 Thread Arnaud Delobelle
On Jan 29, 12:48 pm, Christian Meesters <[EMAIL PROTECTED]> wrote: > Think, that I'm still at the wrong track. Point is that I cannot find any > examples and don't know where to start here. > Perhaps my problem boils down to two questions: > I'd like to pass lists (in some cases nested ones) from P

Re: extending Python - passing nested lists

2008-01-29 Thread Christian Meesters
Think, that I'm still at the wrong track. Point is that I cannot find any examples and don't know where to start here. Perhaps my problem boils down to two questions: I'd like to pass lists (in some cases nested ones) from Python to C and convert those Python-lists to C-arrays (e. g. of doubles). M

Re: extending Python - passing nested lists

2008-01-28 Thread Christian Meesters
Mark Dickinson wrote: > Well, it's pretty clear: you misspelt "length" as "lenght". :) Well, that's not it ;-). (Damn copy & paste plague ...) > > PySequence_Fast doesn't return an array: it returns a PyObject---in > this case, a PyObject corresponding to a Python tuple. That's it. Thanks. Thi

Re: extending Python - passing nested lists

2008-01-28 Thread Mark Dickinson
On Jan 28, 10:10 am, Christian Meesters <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to write a C-extension function for an application of mine. For > this I need to pass a nested list (like: [[a, b, c], [d, e, f], ...], where > all letters are floats) to the C-function. Now, with the code I h

Re: Extending Python with C API

2007-10-18 Thread Sami Vaisanen
On Thu, 13 Sep 2007 21:26:33 -0400, Carsten Haese wrote: > On Thu, 2007-09-13 at 18:05 -0700, Thierry Masson wrote: >> Hello, >> >> I'm trying to use the C API to extend Python. I've looked at various >> books and web sites (including the docs at python.org) and I can't get >> any of the samples

Re: Extending Python with C API

2007-09-13 Thread Thierry Masson
On 9/13/07, Carsten Haese wrote: >Your module C code uses an unknown function by the name of PyBuildValue. >The actual name of the function you mean is Py_BuildValue. Thank you so much, Carsten. I can't believe I missed that underscore! I'm posting the working code below in case it ever turns out

Re: Extending Python with C API

2007-09-13 Thread Carsten Haese
On Thu, 2007-09-13 at 18:05 -0700, Thierry Masson wrote: > Hello, > > I'm trying to use the C API to extend Python. I've looked at various > books and web sites (including the docs at python.org) and I can't get > any of the samples to work. Below is a very minimalist example that > I'm trying to

Re: Extending Python by Adding Keywords & Data types

2007-08-01 Thread Paul McGuire
On Aug 1, 8:08 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > > def add(self,other): > if len(self.contents) < self.capacity: > self.contents.append( other ) > else: > raise ValueError("can't add any more to this Box") > I guess that really should raise a

Re: Extending Python by Adding Keywords & Data types

2007-08-01 Thread Paul McGuire
On Aug 1, 3:10 pm, Maximus Decimus <[EMAIL PROTECTED]> wrote: > > Your code snippet was quite simple and it explained me very well than > the tutorial. HAts off to u!! > Thanks! > > I am doing my research in Pervasive space environments filled with > sensors and actuators. I am just trying to mo

Re: Extending Python by Adding Keywords & Data types

2007-08-01 Thread Maximus Decimus
On Aug 1, 9:08 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Jul 31, 3:28 pm, Maximus Decimus <[EMAIL PROTECTED]> wrote: > > > > > I am using python v2.5 and I am an amateur working on python. I am > > extending python for my research work and would like some help and > > guidance w.r.t this mat

Re: Extending Python by Adding Keywords & Data types

2007-08-01 Thread Paul McGuire
On Jul 31, 3:28 pm, Maximus Decimus <[EMAIL PROTECTED]> wrote: > > I am using python v2.5 and I am an amateur working on python. I am > extending python for my research work and would like some help and > guidance w.r.t this matter from you experienced python developers. > > II want to add some mor

Re: Extending Python by Adding Keywords & Data types

2007-08-01 Thread Bjoern Schliessmann
Maximus Decimus wrote: > Since, I am an amateur in using python, | Most commonly an amateur is understood to be someone who does | something without pay or formal training. Conversely, a | professional is someone who has received training in a particular |

Re: Extending Python by Adding Keywords & Data types

2007-07-31 Thread Marc 'BlackJack' Rintsch
On Wed, 01 Aug 2007 01:42:38 +, Maximus Decimus wrote: > Since, I am an amateur in using python, could you please be more > specific. For new data types, you had asked to implement the classes. > I intend to use C for implementing these data types. So where do i > need to implement these class

Re: Extending Python by Adding Keywords & Data types

2007-07-31 Thread Ben Finney
Maximus Decimus <[EMAIL PROTECTED]> writes: > II want to add some more KEYWORDS Adding keywords can only be done by changing the parser for the Python compiler. You can download the source for your preferred implementation of Python (e.g. CPython) and change it there. But likely that's not the b

Re: Extending Python by Adding Keywords & Data types

2007-07-31 Thread Maximus Decimus
Since, I am an amateur in using python, could you please be more specific. For new data types, you had asked to implement the classes. I intend to use C for implementing these data types. So where do i need to implement these classes ie under which file or module in the python package. Thanks in a

Re: Extending Python by Adding Keywords & Data types

2007-07-31 Thread Marc 'BlackJack' Rintsch
On Tue, 31 Jul 2007 20:28:59 +, Maximus Decimus wrote: > II want to add some more KEYWORDS and DATATYPES into the python script > apart from the existing ones. New data types are easy: Just implement the classes. Why do you need new keywords? Can't the problem at hand be expressed in functi

Re: Extending Python - Understanding Flags...

2006-06-14 Thread Alex Martelli
John Machin <[EMAIL PROTECTED]> wrote: ... > > If it is any consolation I hope to take what I learn and put together > > a tutorial on expanding Python for those that only have a little > > experience with C programming, like myself. I plan to explain > > everything like I was teaching a 6-year

Re: Extending Python - Understanding Flags...

2006-06-12 Thread John Machin
On 13/06/2006 3:11 PM, John Machin wrote: > def bfunction(foo=0, bar="plugh", zot=None): > # keyword args, caller can do: > bfunction(zot=10**100) # using a keyword: args foo & bar get default values > bfunction(10, "xyzzy") # positional: foo = 10; bar = "xyzzy"; zot = 10**100 The last line above

Re: Extending Python - Understanding Flags...

2006-06-12 Thread John Machin
On 13/06/2006 1:45 PM, Redefined Horizons wrote: > I'm trying to understand the argument flags that are used in the > method table of an extension module written in C. > > First let me ask this question about the method table. Is it an C > array named "PyMethodDef"? Its *type* is PyMethodDef (the

Re: Extending Python

2006-04-04 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > We can extend the functionality of python using C,C++.I want to > know what are the other lang that we can use to extend the > functionality of Python? C# or any .NET one in the IronPython implementation, Java (or any other JVM one) in the Jython implementation; f

Re: extending python: which python code calls the c iterator methods?

2006-01-18 Thread Fredrik Lundh
Johannes Zellner wrote: > when extending python there are type methods tp_iter and tp_iternext. > Which python code calls the c iterator methods? iter(obj), for-in obj, etc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python with C++

2005-12-29 Thread jeremito
Unfortunately, I need to know a bit more than just the concept 'extern "C"'. I am really slow at this. Can anyone point me towards some examples or a tutorial (other than the one from python.org, I didn't understand that one)? Thanks, Jeremy -- http://mail.python.org/mailman/listinfo/python-lis

Re: Extending Python with C++

2005-12-29 Thread Brian van den Broek
Brian van den Broek said unto the world upon 29/12/05 12:03 PM: > jeremito said unto the world upon 29/12/05 11:39 AM: > >>I am learning how to extend Pythong with C++. I have will be writing >>some code in C++ and want/need Python to interact with it. I am not >>having success following the onl

Re: Extending Python with C++

2005-12-29 Thread Martin v. Löwis
jeremito wrote: > Oops, sorry. My question is, how can I know if my Python interpreter > was lined by C++? Ah. This documentation fragment is somewhat wrong: it depends on the target operating system and compiler whether you have to link main with a C++ compiler. For many modern systems, this isn

Re: Extending Python with C++

2005-12-29 Thread jeremito
Oops, sorry. My question is, how can I know if my Python interpreter was lined by C++? The non-specific questions are, of course, does anyone have any hints or suggestions? Good websites to visit? Thanks, Jeremy -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python with C++

2005-12-29 Thread Brian van den Broek
jeremito said unto the world upon 29/12/05 11:39 AM: > I am learning how to extend Pythong with C++. I have will be writing > some code in C++ and want/need Python to interact with it. I am not > having success following the online documentation from > http://docs.python.org/ext/ext.html. I have

Re: Extending Python with C++

2005-12-29 Thread Fredrik Lundh
"jeremito" <[EMAIL PROTECTED]> wrote: > I have one specific question. The documentation online states: > > "If the main program (the Python interpreter) is compiled and linked by > the C compiler, global or static objects with constructors cannot be > used. This is not a problem if the main progr

Re: Extending Python

2005-10-08 Thread gene tani
Yup, still there, issues 1 and 2 http://pyzine.com/Issue002/index.html Also recommend Dave Kuhlman's brief intro (open in your tabbed browser) http://www.rexx.com/~dkuhlman/python_201/python_201.html#SECTION00600 Alex Martelli wrote: > Micah Elliott <[EMAIL PROTECTED]> wrote: > >

Re: Extending Python

2005-10-08 Thread Alex Martelli
Micah Elliott <[EMAIL PROTECTED]> wrote: > On Oct 05, Tuvas wrote: > > I am looking for a good tutorial on how to extend python with C > > code. I have an application built in C that I need to be able to use > > in Python. I have searched through various sources, starting of > > course with the Py

Re: Extending Python

2005-10-07 Thread Tuvas
Perhaps it would be nice if they could include in the python documents a link to download a sample code, the one that they were building in the whole program, or at least a page that puts it all together? I get a much better idea of how thing work when they are all put together personally, and then

Re: Extending Python

2005-10-06 Thread Jorgen Grahn
On 5 Oct 2005 10:38:21 -0700, Tuvas <[EMAIL PROTECTED]> wrote: > I am looking for a good tutorial on how to extend python with C code. I > have an application built in C that I need to be able to use in Python. > I have searched through various sources, starting of course with the > Python site its

Re: Extending Python

2005-10-06 Thread Magnus Lycka
Tuvas wrote: > I am looking for a good tutorial on how to extend python with C code. I > have an application built in C that I need to be able to use in Python. > I have searched through various sources, starting of course with the > Python site itself, and others, but I felt a bit lacking from the

Re: Extending Python

2005-10-06 Thread Miki Tebeka
Hello Tuvas, > I am looking for a good tutorial on how to extend python with C code. I > have an application built in C that I need to be able to use in Python. http://www.swig.org/Doc1.3/Python.html#Python > I have searched through various sources, starting of course with the > Python site itsel

Re: Extending Python

2005-10-05 Thread Brandon K
I own Python in a Nutshell, as one person pointed out. Alex Martelli does a great job of introducing the concepts, as long as your'e familiar with C. Additionally he covers wrapping (which is sounds like you're trying to do) with SWIG, Pyrex, and a few other options. It's a great book, I hav

Re: Extending Python

2005-10-05 Thread Fredrik Lundh
"Tuvas" wrote: >I am looking for a good tutorial on how to extend python with C code. I > have an application built in C that I need to be able to use in Python. http://docs.python.org/ext/ext.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python

2005-10-05 Thread Micah Elliott
On Oct 05, Tuvas wrote: > I am looking for a good tutorial on how to extend python with C > code. I have an application built in C that I need to be able to use > in Python. I have searched through various sources, starting of > course with the Python site itself, and others, but I felt a bit > lac

Re: Extending python - undefined symbol error on import

2005-07-25 Thread ch424
Sweet! It works! *dances* Thank you so much -- and for the explanation! For anyone searching for this, I had to change the respective lines to: module1 = Extension('gpibmodule', libraries = ['gpibapi'], sources = ['gpibmodule.c']) just as Daniel said. Thanks agai

Re: Extending python - undefined symbol error on import

2005-07-22 Thread John Machin
ch424 wrote: [snip] > However, when I open up the python command line, and type "from gpib > import *" or "import gpib" I get "ImportError: /usr/.../gpibmodule.so: > undefined symbol: ibdev" -- but I know it's defined in the ni488.h > file, especially as I can use this code from actual C programs

Re: Extending python - undefined symbol error on import

2005-07-22 Thread Daniel Dittmar
ch424 wrote: > However, when I open up the python command line, and type "from gpib > import *" or "import gpib" I get "ImportError: /usr/.../gpibmodule.so: > undefined symbol: ibdev" -- but I know it's defined in the ni488.h > file, especially as I can use this code from actual C programs without

Re: extending Python base class in C

2005-06-15 Thread harold fellermann
Yah! Finally, I got the thing to work. Here is how I did it. /* import the module that holds the base class */ PyObject *base_module = PyImport_ImportModule("module_name"); if (!base_module) return; /* get a pointer to the base class */ PyObject *base_class = PyMapping_GetItemString(

Re: extending Python base class in C

2005-06-14 Thread Scott David Daniels
harold fellermann wrote: > ... > This gives me a pointer to the class I want to use as base class. > Does anyone know how to assign this to the extension class? I tried > to build a tuple (BaseClass,) and assign it (after the respective > PyType_Ready call) ... I think this is your problem -- call

Re: extending Python base class in C

2005-06-14 Thread harold fellermann
> "harold fellermann" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > Hi all, > > I once read that it is possible to use a python base class for a C > extension class. On 14.06.2005, at 09:29, Grigoris Tsolakidis wrote: > There was good article of how to do this on DDJ home page

Re: extending Python base class in C

2005-06-14 Thread Grigoris Tsolakidis
There was good article of how to do this on DDJ home page www.ddj.com "harold fellermann" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi all, I once read that it is possible to use a python base class for a C extension class. To be precise, I want to achieve the following behavior

Re: Extending Python

2005-06-09 Thread Terry Reedy
"Johannes" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I am thinking of replacing Lua as internal script controller and I know >how to extend/embed python but is > there a way of limiting what functionality can be actually be accessible > to the user, f.e. I don't want the scri

Re: extending python with a C-written dll

2004-12-21 Thread Scott David Daniels
Jean-Baptiste PERIN wrote: I can already conclude that either I don't know how to use lcc or it doesn't suit my needs .. I plan to first test the cygwin's gcc compiler before goign to MinGW32 MinGW32 is "Minimalist Gnu for Windows -- 32-bit," and _works_ at being ABI compatible with Microsoft's ABI

Re: extending python with a C-written dll

2004-12-21 Thread Jean-Baptiste PERIN
John Machin a écrit : Jean-Baptiste PERIN wrote: Hi, I'm trying to make a windows dll reachable from a python script .. and I'm encountering troubles during link step .. I use "lcc" to compile and link I use python 2.3 under win XP [snip] Here are the errors : - Error c:\...\plu

Re: extending python with a C-written dll

2004-12-21 Thread Jean-Baptiste PERIN
Note that MinGW32 is a tested path for building (free) C extensions. I don't know if anyone has a tested way of using lcc. Yes, very interesting I can already conclude that either I don't know how to use lcc or it doesn't suit my needs .. in both case I have to quickly get rid of it .. before I t

Re: extending python with a C-written dll

2004-12-21 Thread Jean-Baptiste PERIN
Jean Brouwers a écrit : First, you might check the calldll module available here I have one or two things to try before ..but it looks interesting .. thank you very much .. Take a look at Pyrex, it may fit your requirements to access C from Python.

Re: extending python with a C-written dll

2004-12-21 Thread Jean-Baptiste PERIN
Steve Holden a écrit : Jean-Baptiste PERIN wrote: >> error: Python was built with version 6 of Visual Studio, and extensions need to be built with the same version of the compiler, but it isn't installed. How do you expect to be able to write your own extension if you don't have the environmen

Re: extending python with a C-written dll

2004-12-21 Thread Jean-Baptiste PERIN
That's got nothing to do with Python. You have to compile extensions using a compiler that has an ABI that's compatible with the ABI of the compiler used to compile Python. You appear to be using a binary distribution of Python that was compiled with MSVS 6.0, therefore, you have to compile exten

Re: extending python with a C-written dll

2004-12-20 Thread Fredrik Lundh
John Machin wrote: > By the way, lcc also *appears* to change "...Module3" to "...Module4" :-) $ more Include/modsupport.h ... #define Py_InitModule3(name, methods, doc) \ Py_InitModule4(name, methods, doc, (PyObject *)NULL, \ PYTHON_API_VERSION) ... -- ht

Re: extending python with a C-written dll

2004-12-20 Thread John Machin
Jean-Baptiste PERIN wrote: > Hi, > > I'm trying to make a windows dll reachable from a python script .. and > I'm encountering troubles during link step .. > > I use "lcc" to compile and link > I use python 2.3 under win XP [snip] > Here are the errors : > - > Error c:\...\plug

Re: extending python with a C-written dll

2004-12-20 Thread Jean Brouwers
First, you might check the calldll module available here Take a look at Pyrex, it may fit your requirements to access C from Python. If you do not have these already, you may need the Win32 API e

Re: extending python with a C-written dll

2004-12-20 Thread Steve Holden
Jean-Baptiste PERIN wrote: >> error: Python was built with version 6 of Visual Studio, and extensions need to be built with the same version of the compiler, but it isn't installed. How do you expect to be able to write your own extension if you don't have the environment to do so in the first

Re: extending python with a C-written dll

2004-12-20 Thread Grant Edwards
On 2004-12-20, Jean-Baptiste PERIN <[EMAIL PROTECTED]> wrote: > I know it has nothing to do with python .. > It just makes me sad to see that python cannot get rid of Visual Studoi > to be extended. That's got nothing to do with Python. You have to compile extensions using a compiler that has a

Re: extending python with a C-written dll

2004-12-20 Thread Jean-Baptiste PERIN
>> error: Python was built with version 6 of Visual Studio, and extensions need to be built with the same version of the compiler, but it isn't installed. How do you expect to be able to write your own extension if you don't have the environment to do so in the first place? that error has nothin

Re: extending python with a C-written dll

2004-12-20 Thread Scott David Daniels
Jean-Baptiste PERIN wrote: Hi, I'm trying to make a windows dll reachable from a python script .. and I'm encountering troubles during link step .. I use "lcc" to compile and link I use python 2.3 under win XP Note that MinGW32 is a tested path for building (free) C extensions. I don't know if a

Re: extending python with a C-written dll

2004-12-20 Thread Diez B. Roggisch
> and look at the expected result .. it is far simpler from the python > side view But you have to do all the C-Work! > > I think ctype is uselful when dealing with dll you're not the author of It is useful, if you don't want to write an extension for the extra work that is needed for that - f

Re: extending python with a C-written dll

2004-12-20 Thread Jean-Baptiste PERIN
Diez B. Roggisch a écrit : The fact is that the python interpreter I use is not a standard one It is a python interpreter delivered within a software named Blender. I don't know whether it is possible or not to add ctypes to it ..(I don't even have a python shell to perform the setup) I'm sure it i

Re: extending python with a C-written dll

2004-12-20 Thread Jean-Baptiste PERIN
thanks for your valuable help .. ctypes is not lost for ever ..I'm going to explore a little bit .. it may suit my need in the end .. I had read : http://www.python.org/dev/doc/devel/ext/intro.html and eveything looked so simple in it .. I'm sad to realize that it only works for linux plateform

Re: extending python with a C-written dll

2004-12-20 Thread Diez B. Roggisch
> The fact is that the python interpreter I use is not a standard one > It is a python interpreter delivered within a software named Blender. > I don't know whether it is possible or not to add ctypes to it ..(I > don't even have a python shell to perform the setup) > > I'm sure it is possible to

Re: extending python with a C-written dll

2004-12-20 Thread Grant Edwards
On 2004-12-20, Jean-Baptiste PERIN <[EMAIL PROTECTED]> wrote: > OK .. ctypes looks great .. and I plan to use it for futur > purposes > > The fact is that the python interpreter I use is not a > standard one It is a python interpreter delivered within a > software named Blender. I don't know wheth

  1   2   >