Re: Embedding Python in C

2019-07-24 Thread Jesse Ibarra
On Tuesday, July 23, 2019 at 2:20:45 PM UTC-6, Stefan Behnel wrote: > Jesse Ibarra schrieb am 22.07.19 um 18:12: > > On Saturday, July 20, 2019 at 1:11:51 PM UTC-6, Stefan Behnel wrote: > >> Jesse Ibarra schrieb am 20.07.19 um 04:12: > >>> Sorry, I am not understanding. Smalltlak VW 8.3 does not su

Re: Embedding Python in C

2019-07-23 Thread Stefan Behnel
Jesse Ibarra schrieb am 22.07.19 um 18:12: > On Saturday, July 20, 2019 at 1:11:51 PM UTC-6, Stefan Behnel wrote: >> Jesse Ibarra schrieb am 20.07.19 um 04:12: >>> Sorry, I am not understanding. Smalltlak VW 8.3 does not support Python. >>> I can only call Pyhton code through C/Python API. >> >> Ok

Re: Embedding Python in C

2019-07-22 Thread Jesse Ibarra
On Saturday, July 20, 2019 at 1:11:51 PM UTC-6, Stefan Behnel wrote: > Jesse Ibarra schrieb am 20.07.19 um 04:12: > > Sorry, I am not understanding. Smalltlak VW 8.3 does not support Python. > > I can only call Pyhton code through C/Python API. > > Ok, but that doesn't mean you need to write code

Re: Embedding Python in C

2019-07-20 Thread Stefan Behnel
Jesse Ibarra schrieb am 20.07.19 um 04:12: > Sorry, I am not understanding. Smalltlak VW 8.3 does not support Python. > I can only call Pyhton code through C/Python API. Ok, but that doesn't mean you need to write code that uses the C-API of Python. All you need to do is: 1) Start up a CPython ru

Re: Embedding Python in C

2019-07-19 Thread dieter
Jesse Ibarra writes: > ... > Now ,I need to bring in shared libraries using C/Python API using Smalltalk. > It seems like I can't directly bring in C shared libraries (.so files). > PROBLEM. With Python, you typically do not load ("bring in") shared libraries explicitly; instead, you simply imp

Re: Embedding Python in C

2019-07-19 Thread Jesse Ibarra
Sorry, I am not understanding. Smalltlak VW 8.3 does not support Python. I can only call Pyhton code through C/Python API. -- https://mail.python.org/mailman/listinfo/python-list

Re: Embedding Python in C

2019-07-19 Thread Stefan Behnel
Jesse Ibarra schrieb am 17.07.19 um 20:39: > My options seem rather limited, I need to make a Pipeline from > (Smalltalk -> C -> Python) then go back (Smalltalk <- C <- Python). > Since Smalltalk does not support Python directly I have to settle with > the C/Python API > (https://docs.python.org/3.

Re: Embedding Python in C

2019-07-19 Thread Christian Gollwitzer
Am 19.07.19 um 16:26 schrieb Jesse Ibarra: On Friday, July 19, 2019 at 8:17:43 AM UTC-6, Chris Angelico wrote: On Sat, Jul 20, 2019 at 12:16 AM Jesse Ibarra wrote: On Thursday, July 18, 2019 at 2:01:39 PM UTC-6, Chris Angelico wrote: On Fri, Jul 19, 2019 at 5:51 AM Christian Gollwitzer wrot

Re: Embedding Python in C

2019-07-19 Thread Jesse Ibarra
On Friday, July 19, 2019 at 8:17:43 AM UTC-6, Chris Angelico wrote: > On Sat, Jul 20, 2019 at 12:16 AM Jesse Ibarra > wrote: > > > > On Thursday, July 18, 2019 at 2:01:39 PM UTC-6, Chris Angelico wrote: > > > On Fri, Jul 19, 2019 at 5:51 AM Christian Gollwitzer > > > wrote: > > > > Once you can

Re: Embedding Python in C

2019-07-19 Thread Jesse Ibarra
On Thursday, July 18, 2019 at 1:46:05 PM UTC-6, Christian Gollwitzer wrote: > Am 18.07.19 um 16:18 schrieb Jesse Ibarra: > > On Wednesday, July 17, 2019 at 2:20:51 PM UTC-6, Christian Gollwitzer wrote: > >> What level of integration do you want to achieve? Do you want > >> > >> a) to call Python fu

Re: Embedding Python in C

2019-07-19 Thread Chris Angelico
On Sat, Jul 20, 2019 at 12:16 AM Jesse Ibarra wrote: > > On Thursday, July 18, 2019 at 2:01:39 PM UTC-6, Chris Angelico wrote: > > On Fri, Jul 19, 2019 at 5:51 AM Christian Gollwitzer > > wrote: > > > Once you can do this, you can proceed to call a Python function, which > > > in C means that yo

Re: Embedding Python in C

2019-07-19 Thread Jesse Ibarra
On Thursday, July 18, 2019 at 2:01:39 PM UTC-6, Chris Angelico wrote: > On Fri, Jul 19, 2019 at 5:51 AM Christian Gollwitzer wrote: > > Once you can do this, you can proceed to call a Python function, which > > in C means that you invoke the function PyObject_CallObject(). A basic > > example is s

Re: Embedding Python in C

2019-07-18 Thread Chris Angelico
On Fri, Jul 19, 2019 at 5:51 AM Christian Gollwitzer wrote: > Once you can do this, you can proceed to call a Python function, which > in C means that you invoke the function PyObject_CallObject(). A basic > example is shown here: > > https://docs.python.org/2/extending/embedding.html#pure-embeddi

Re: Embedding Python in C

2019-07-18 Thread Christian Gollwitzer
Am 18.07.19 um 16:18 schrieb Jesse Ibarra: On Wednesday, July 17, 2019 at 2:20:51 PM UTC-6, Christian Gollwitzer wrote: What level of integration do you want to achieve? Do you want a) to call Python functions from Smalltalk b) call Smalltalk functions from Python c) pass callbacks around, e.g.

Re: Embedding Python in C

2019-07-18 Thread Jesse Ibarra
On Wednesday, July 17, 2019 at 2:20:51 PM UTC-6, Christian Gollwitzer wrote: > Am 17.07.19 um 20:39 schrieb Jesse Ibarra: > > My options seem rather limited, I need to make a Pipeline from (Smalltalk > > -> C -> Python) then go back (Smalltalk <- C <- Python). Since Smalltalk > > does not support

Re: Embedding Python in C

2019-07-18 Thread Barry Scott
> On 17 Jul 2019, at 19:39, Jesse Ibarra wrote: > > On Wednesday, July 17, 2019 at 11:55:28 AM UTC-6, Barry Scott wrote: >>> On 17 Jul 2019, at 16:57, wrote: >>> >>> I am using Python3.6: >>> >>> [jibarra@redsky ~]$ python3.6 >>> Python 3.6.8 (default, Apr 25 2019, 21:02:35) >>> [GCC 4.8.5

Re: Embedding Python in C

2019-07-17 Thread dieter
Jesse Ibarra writes: > ... > My options seem rather limited, I need to make a Pipeline from (Smalltalk -> > C -> Python) then go back (Smalltalk <- C <- Python). Since Smalltalk does > not support Python directly I have to settle with the C/Python API > (https://docs.python.org/3.6/extending/em

Re: Embedding Python in C

2019-07-17 Thread Christian Gollwitzer
Am 17.07.19 um 20:39 schrieb Jesse Ibarra: My options seem rather limited, I need to make a Pipeline from (Smalltalk -> C -> Python) then go back (Smalltalk <- C <- Python). Since Smalltalk does not support Python directly I have to settle with the C/Python API (https://docs.python.org/3.6/ext

Re: Embedding Python in C

2019-07-17 Thread Jesse Ibarra
On Wednesday, July 17, 2019 at 11:55:28 AM UTC-6, Barry Scott wrote: > > On 17 Jul 2019, at 16:57, wrote: > > > > I am using Python3.6: > > > > [jibarra@redsky ~]$ python3.6 > > Python 3.6.8 (default, Apr 25 2019, 21:02:35) > > [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux > > Type "help", "

Re: Embedding Python in C

2019-07-17 Thread Barry Scott
> On 17 Jul 2019, at 16:57, jesse.ibarra.1...@gmail.com wrote: > > I am using Python3.6: > > [jibarra@redsky ~]$ python3.6 > Python 3.6.8 (default, Apr 25 2019, 21:02:35) > [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux > Type "help", "copyright", "credits" or "license" for more information

Embedding Python in C

2019-07-17 Thread jesse . ibarra . 1996
I am using Python3.6: [jibarra@redsky ~]$ python3.6 Python 3.6.8 (default, Apr 25 2019, 21:02:35) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux Type "help", "copyright", "credits" or "license" for more information. I am referencing:https://docs.python.org/3.6/extending/embedding.html#beyond

Windows - Embedded Python in C++: ImportError: DLL load failed. Python expert advice needed.

2016-01-27 Thread ftpronk
I've been busy porting a Linux code to Windows, and originally decided to go for the mingw-w64 toolchain set, with gcc-4.8 and win32 threading model. I'm embedding Python in C++ code, and I need to be able to import specific modules, like PySide, to eventually embed an IPython qtcons

Re: real-time monitoring of propriety system: embedding python in C or embedding C in python?

2013-02-05 Thread Terry Reedy
On 2/5/2013 10:23 AM, Duncan Booth wrote: Bas wrote: A) Implement the main program in C. In a loop, get a chunk of data using direct call of C functions, convert data to python variables and call an embedded python interpreter that runs one iteration of the user's algorithm. When the script fi

Re: real-time monitoring of propriety system: embedding python in C or embedding C in python?

2013-02-05 Thread Stefan Behnel
Bas, 05.02.2013 16:10: > at work, we are thinking to replace some legacy application, which is a > home-grown scripting language for monitoring and controlling a large > experiment. It is able to read live data from sensors, do some simple > logic and calculations, send commands to other subsystems

Re: real-time monitoring of propriety system: embedding python in C or embedding C in python?

2013-02-05 Thread rusi
On Feb 5, 8:10 pm, Bas wrote: > Since all the functions I have to interface with (read and write of live > data, sending > commands, ...) are implemented in C, the solution will require writing both C > and python. Standard embedding/extending is ok when the interface is 'thin' ie the number of

Re: real-time monitoring of propriety system: embedding python in C or embedding C in python?

2013-02-05 Thread Duncan Booth
Bas wrote: > A) Implement the main program in C. In a loop, get a chunk of data > using direct call of C functions, convert data to python variables and > call an embedded python interpreter that runs one iteration of the > user's algorithm. When the script finishes, you read some variables > fro

real-time monitoring of propriety system: embedding python in C or embedding C in python?

2013-02-05 Thread Bas
Hi Group, at work, we are thinking to replace some legacy application, which is a home-grown scripting language for monitoring and controlling a large experiment. It is able to read live data from sensors, do some simple logic and calculations, send commands to other subsystems and finally gene

Re: Python in C

2008-12-30 Thread Stefan Behnel
akineko wrote: > The more you work on Python, the harder you can go back to C or C++ > world. > > I use SWIG, instead. I think SWIG is a good way to mix two worlds. If you find it hard to go from Python back to C, you should have a look at Cython. http://cython.org/ Stefan -- http://mail.python

Re: Python in C

2008-12-30 Thread akineko
Hello Skip, Thank you for your response. Your posting reminds me that we, Python community as a whole, owe a great deal to Python developers. The problem is ... The more you work on Python, the harder you can go back to C or C++ world. I use SWIG, instead. I think SWIG is a good way to mix two w

Re: Python in C

2008-12-30 Thread skip
aki> Although this is not what you are asking but I'm wondering why you aki> need to read CPython implementation. A couple reasons come to mind: * education * want to make it better (extend it, fix bugs, etc) * want to see how it relates to the implementation of other langua

Re: Python in C

2008-12-29 Thread akineko
Although this is not what you are asking but I'm wondering why you need to read CPython implementation. I have been using Python for 7 or 8 years but I've never encountered any situations where I need to read CPython implementation. I needed to read library implementations and installer codes, thou

Re: Python in C

2008-12-29 Thread Gabriel Genellina
En Tue, 30 Dec 2008 00:32:45 -0200, escribió: BTW, as a person who hasn't really written a stitch of C++ in about 10 years I personally find the CPython implementation to be one of the most well-organized large pieces of code I have ever encountered. It's much easier to read (to me) than any

Re: Python in C

2008-12-29 Thread David Cournapeau
On Tue, Dec 30, 2008 at 10:22 AM, wrote: > I've just downloaded Python's mainstream implementation (CPython), > which is written in C. Not to my surprise, I feel like I'm looking at > unstructured spaghetti, and I'm having trouble figuring out how it all > works together. (Please bear with me; I'

Re: Python in C

2008-12-29 Thread skip
thmpsn> 1. Can anyone explain to me what kind of program structuring thmpsn>technique (which paradigm, etc) CPython uses? How do modules thmpsn>interact together? What conventions does it use? it's quite object-oriented once you understand how things are done. Take a look, f

Re: Python in C

2008-12-29 Thread Paul Rubin
thmpsn@gmail.com writes: > 1. Can anyone explain to me what kind of program structuring technique > (which paradigm, etc) CPython uses? How do modules interact together? > What conventions does it use? There are a bunch of docs about this, you could read them. The program is written about the

Re: Python in C

2008-12-29 Thread James Mills
On Tue, Dec 30, 2008 at 11:32 AM, Chris Rebert wrote: > On Mon, Dec 29, 2008 at 5:22 PM, wrote: > >> 2. Have there been any suggestions in the past to rewrite Python's >> mainstream implementation in C++ (or why wasn't it done this way from >> the beginning)? > > I'm not a CPython dev (I bet on

Re: Python in C

2008-12-29 Thread Chris Rebert
On Mon, Dec 29, 2008 at 5:22 PM, wrote: > 2. Have there been any suggestions in the past to rewrite Python's > mainstream implementation in C++ (or why wasn't it done this way from > the beginning)? I'm not a CPython dev (I bet one will pipe in), but I would speculate it's because C++ is so muc

Python in C

2008-12-29 Thread thmpsn . m . k
I've just downloaded Python's mainstream implementation (CPython), which is written in C. Not to my surprise, I feel like I'm looking at unstructured spaghetti, and I'm having trouble figuring out how it all works together. (Please bear with me; I'm just going through the usual frustration that any

Re: Module import path when embedding python in C

2008-09-26 Thread Christian Heimes
graph wrote: Does anyone know why PySys_GetObject wasn't documented until somewhat recently (http://bugs.python.org/issue1245) if it has been part of the system module interface since at least Python 1.5.2? Is it not supposed to be used? What's the difference the above and importing the sys mod

Module import path when embedding python in C

2008-09-26 Thread graph
Per http://mail.python.org/pipermail/python-list/2008-September/506206.html something like this (plus error handling) seems to be the right way to add to sys.path when embedding python in C: PyObject *sys_path = PySys_GetObject("path"); PyObject *path = PyString_FromString(&

Re: embedded python in c++ packaging

2008-03-25 Thread Furkan Kuru
nely control what you expose to python, so you don't > wind up exposing the whole C++ API. > > > > > > > > > > -- > *From:* Furkan Kuru [mailto:[EMAIL PROTECTED] > *Sent:* Thursday, February 07, 2008 6:06 PM > *To:* python-list@p

Re: ImportError while Embedding python in C

2008-03-15 Thread kaush
On Mar 15, 2:10 am, kaush <[EMAIL PROTECTED]> wrote: > Hi All, > > I have a simple python script saved to "test.py" as > > import os > import base64 > > def Testfunction(): > print "Hello World" > return > > Testfunction() > > I am trying to invoke this from a C program as follows > > int m

ImportError while Embedding python in C

2008-03-15 Thread kaush
Hi All, I have a simple python script saved to "test.py" as import os import base64 def Testfunction(): print "Hello World" return Testfunction() I am trying to invoke this from a C program as follows int main(int argc, char* argv[]) { Py_Initialize(); PyObject* main_

Re: embedded python in c++ packaging

2008-02-07 Thread Gabriel Genellina
En Thu, 07 Feb 2008 21:05:46 -0200, Furkan Kuru <[EMAIL PROTECTED]> escribió: > I do not have access to my development machine right now. > but is it enough adding just a simple line at the top of my main python > file > 'sys.path.append("modules.zip")' before importing any other modules? Alm

RE: embedded python in c++ packaging

2008-02-07 Thread Bronner, Gregory
e. I use one giant SWIG module (see init function above) SWIG allows you to finely control what you expose to python, so you don't wind up exposing the whole C++ API. From: Furkan Kuru [mailto:[EMAIL PROTECTED] Sent: Thursday, Feb

Re: embedded python in c++ packaging

2008-02-07 Thread Furkan Kuru
I do not have access to my development machine right now. but is it enough adding just a simple line at the top of my main python file 'sys.path.append("modules.zip")' before importing any other modules? On 2/7/08, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > En Thu, 07 Feb 2008 16:18:57 -0200

Re: embedded python in c++ packaging

2008-02-07 Thread Gabriel Genellina
En Thu, 07 Feb 2008 16:18:57 -0200, Joshua Kugler <[EMAIL PROTECTED]> escribió: > Furkan Kuru wrote: >> >> I have been developing an application in C++ that embeds Python >> interpreter. It takes advantage of too many modules from Python. >> When I want to package this application, I need to add

Re: embedded python in c++ packaging

2008-02-07 Thread Joshua Kugler
Furkan Kuru wrote: > Hello, > > I have been developing an application in C++ that embeds Python > interpreter. It takes advantage of too many modules from Python. > When I want to package this application, I need to add too many files > (.pyc) from Python/lib folder together with Python25.dll. > I

Re: embedded python in c++ packaging

2008-02-07 Thread Warren Myers
The Python byte-code files are already pretty dense, so compressing them further is unlikely to work if you try to put them in a zip. WMM On Feb 7, 2008 11:39 AM, Furkan Kuru <[EMAIL PROTECTED]> wrote: > Hello, > > I have been developing an application in C++ that embeds Python > interpreter. >

embedded python in c++ packaging

2008-02-07 Thread Furkan Kuru
Hello, I have been developing an application in C++ that embeds Python interpreter. It takes advantage of too many modules from Python. When I want to package this application, I need to add too many files (.pyc) from Python/lib folder together with Python25.dll. Is there a way to pack these .pyc

Re: Can I embed Windows Python in C# or VC++?

2007-12-07 Thread Christian Heimes
sturlamolden wrote: > The answer is YES. C# can access C functions exported by any DLL with > platform invoke. Since the Python C API is plain C and not C++ you can > gain access to it from C#. Import System.Runtime.InteropServices and > write wrappers like > > [DllImport("Python25.dll"), CallingC

Re: Can I embed Windows Python in C# or VC++?

2007-12-07 Thread sturlamolden
On 7 Des, 08:07, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > Does it mean, I can embed Python in C# as well with the same APIs? > > No; you can use the Python API in a native C++ application (the Python > code is plain C, but all the include files have the

Re: Can I embed Windows Python in C# or VC++?

2007-12-07 Thread Christian Heimes
grbgooglefan wrote: > 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

Re: Can I embed Windows Python in C# or VC++?

2007-12-07 Thread Virgil Dupras
ng > > >> the include, lib & the > > >> > python25.dll files availale after installing this MSI? > > > >> Yes. You don't require the source package to embed Python and use the > > >> API in your programs. > > > > Does it

Re: Can I embed Windows Python in C# or VC++?

2007-12-07 Thread grbgooglefan
on the > >> > Python expressions which are later supposed to be evaluated at runtime > >> > by another C++ program [...]> Can I start doing the development using > >> the include, lib & the > >> > python25.dll files availale after installing thi

Re: Can I embed Windows Python in C# or VC++?

2007-12-06 Thread Gabriel Genellina
I start doing the development using >> the include, lib & the >> > python25.dll files availale after installing this MSI? >> >> Yes. You don't require the source package to embed Python and use the >> API in your programs. > > Does it mean, I can e

Re: Can I embed Windows Python in C# or VC++?

2007-12-06 Thread grbgooglefan
; > python25.dll files availale after installing this MSI? > > Yes. You don't require the source package to embed Python and use the API > in your programs. > > -- > Gabriel Genellina Does it mean, I can embed Python in C# as well with the same APIs? -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I embed Windows Python in C# or VC++?

2007-12-06 Thread Gabriel Genellina
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 VC++) program for performing syntax checks on the > Python expressions which are later supposed to be evaluated at runtime > by a

Can I embed Windows Python in C# or VC++?

2007-12-06 Thread grbgooglefan
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

Re: Question on compiled code when embedding Python in C++

2007-12-03 Thread grbgooglefan
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

Re: Question on compiled code when embedding Python in C++

2007-12-03 Thread Gabriel Genellina
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 resulting > executable code? > Will it be byte code somewhat like the byte code o

Question on compiled code when embedding Python in C++

2007-12-03 Thread Borse, Ganesh
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

Re: Question about embedding python in C++

2007-08-23 Thread TheShadow
On Aug 23, 1:17 pm, TheShadow <[EMAIL PROTECTED]> wrote: > On Aug 23, 11:57 am, Farshid Lashkari <[EMAIL PROTECTED]> wrote: > > > TheShadow wrote: > > > When extending python in c/c++ after you register a module is there a > > > way in c/c++

Re: Question about embedding python in C++

2007-08-23 Thread TheShadow
On Aug 23, 11:57 am, Farshid Lashkari <[EMAIL PROTECTED]> wrote: > TheShadow wrote: > > When extending python in c/c++ after you register a module is there a > > way in c/c++ to check if they were correctly registered? > > > Cause I'm having the problem

Re: Question about embedding python in C++

2007-08-23 Thread TheShadow
On Aug 23, 11:57 am, Farshid Lashkari <[EMAIL PROTECTED]> wrote: > TheShadow wrote: > > When extending python in c/c++ after you register a module is there a > > way in c/c++ to check if they were correctly registered? > > > Cause I'm having the problem

Re: Question about embedding python in C++

2007-08-23 Thread Farshid Lashkari
TheShadow wrote: > When extending python in c/c++ after you register a module is there a > way in c/c++ to check if they were correctly registered? > > Cause I'm having the problem where when I execute the the python > script it finds the module but none of the functions.

Question about embedding python in C++

2007-08-23 Thread TheShadow
When extending python in c/c++ after you register a module is there a way in c/c++ to check if they were correctly registered? Cause I'm having the problem where when I execute the the python script it finds the module but none of the functions. -- http://mail.python.org/mailman/listinfo/p

Re: Embedding Python in C

2007-06-06 Thread mistabean
On 6 Jun., 05:44, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > Python lists and tuples are "generic" containers: both can contain any > kind of object, and each item may be of a different type: (1, 2.0, 3+0j, > "four", u"Fünf", file("six")) is a tuple containing 6 items, all of > differe

Re: Embedding Python in C

2007-06-05 Thread Gabriel Genellina
En Tue, 05 Jun 2007 03:41:19 -0300, <[EMAIL PROTECTED]> escribió: > On 5 Jun., 01:32, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >> Yes, it appears that you are building a plain list but your code is >> expecting another kind of object. I'm unfamiliar with Numeric arrays, if >> that is what y

Re: Embedding Python in C

2007-06-05 Thread Joe Riopel
This seems like a pretty good resource, although I didn't read it all yet: http://www.ibm.com/developerworks/edu/l-dw-linux-pythonscript-i.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedding Python in C

2007-06-05 Thread mistabean
now then... where's the edit button...? oh well, double-posting. Problem solved, thanks for pointing out that I am needing a numeric array built instead of building a normal list/ tuple. For those who are curious, steps to solving: ... #include "libnumarray.h" /*from numpy*/ ... ... ... void Cal

Re: Embedding Python in C

2007-06-04 Thread mistabean
On 5 Jun., 01:32, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 04 Jun 2007 11:58:38 -0300, <[EMAIL PROTECTED]> escribió: > > > > > > > Onwards to the problem, I have been having difficulty embedding a > > python module into my C/C++ program. (just a test program before > > moving on int

Re: Embedding Python in C

2007-06-04 Thread Gabriel Genellina
En Mon, 04 Jun 2007 11:58:38 -0300, <[EMAIL PROTECTED]> escribió: > Onwards to the problem, I have been having difficulty embedding a > python module into my C/C++ program. (just a test program before > moving on into the real thing). I have been making test runs using the > codes from http://docs

Embedding Python in C

2007-06-04 Thread mistabean
Hello, first of all, I am a programming newbie, especially in python... Onwards to the problem, I have been having difficulty embedding a python module into my C/C++ program. (just a test program before moving on into the real thing). I have been making test runs using the codes from http://docs.

Re: Can't embed python in C++(Mingw[3.*] compiler)

2007-05-20 Thread sturlamolden
On May 19, 6:14 pm, Arjun Narayanan <[EMAIL PROTECTED]> wrote: > For thr program, > #include "E:\Python25\include\Python.h" Consider using #include "E:/Python25/include/Python.h" or #include "E:\\Python25\\include\\Python.h" instead. Or use #include and compile with -IE:/Python25/include

Re: Can't embed python in C++(Mingw[3.*] compiler)

2007-05-20 Thread Michael Hoffman
Arjun Narayanan wrote: > That AND I didn't use the american spelling Py_Initiali >>> Z <<< e(); Like many words ending in -ize/-ise, initialize is listed with what you call the "American" spelling in the Oxford English Dictionary. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/p

Re: Can't embed python in C++(Mingw[3.*] compiler)

2007-05-19 Thread Arjun Narayanan
On May 20, 1:28 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sat, 19 May 2007 13:14:40 -0300, Arjun Narayanan > <[EMAIL PROTECTED]> escribió: > > > For thr program, > > #include "E:\Python25\include\Python.h" > > #include > > Configure your environment so using: > > #include > > works (

Re: Can't embed python in C++(Mingw[3.*] compiler)

2007-05-19 Thread Gabriel Genellina
En Sat, 19 May 2007 13:14:40 -0300, Arjun Narayanan <[EMAIL PROTECTED]> escribió: > For thr program, > #include "E:\Python25\include\Python.h" > #include Configure your environment so using: #include works (you may need to add E:\Python25\include to some list of searched directories, maybe

Can't embed python in C++(Mingw[3.*] compiler)

2007-05-19 Thread Arjun Narayanan
For thr program, #include "E:\Python25\include\Python.h" #include int main(int argc, char* argv[]){ Py_Initialise(); Py_Finalise(); return 0; } I get the errors, main.cpp:7: `Py_Initialise' undeclared (first use this function) main.cpp:7: (Each undeclared identifier is reported only on

Re: Embedding Python in C/C++

2006-08-10 Thread kingcrustybun
We are still struggling with this but having spent many hours looking at related code on the net, i have noticed the following sequence quite a lot globals = PyDict_New(); PyDict_SetItemString(globals, "__builtins__", PyEval_GetBuiltins()); Can anyone explain what this does exactly? I know what "

Embedding Python in C/C++

2006-08-09 Thread kingcrustybun
Not a Python newb but a bit out of my depth here... We are trying to use the Python interpreter from within a C/C++ aplication to execute Python code which is in an external file. The idea is to share a dictionary between the C app and the python script. After Py_Initialize() we do something like

Re: how to read a list from python in C?

2006-05-19 Thread Lialie
Thanks for your reply. yes, I pass a list as an argument to the function in C. The list has a random length. Do you mean to do it in this way? use PyTuple_Size(args), in a loop use PyTuple_GetItem(args, i) or use PyArg_VaParse? Best Regards -- http://mail.python.org/mailman/listinfo/python-

Re: how to read a list from python in C?

2006-05-19 Thread skip
lialie> The list has a random length. lialie> Do you mean to do it in this way? lialie> use PyTuple_Size(args), in a loop lialie> use PyTuple_GetItem(args, i) lialie> or lialie> use PyArg_VaParse? Sketch (that means off-the-top-of-my-head, untested, 99.9% guaranteed inco

Re: how to read a list from python in C?

2006-05-19 Thread skip
Lialie> I am writing a C extension with .Net. Now I have a list of Lialie> points, like [(0.0, 0.0), (2.0, 3.0), (random x, random y)]. Lialie> Is there a better way to translate it to an array than doing it Lialie> one by one? Are you passing a list as an argument to one of

how to read a list from python in C?

2006-05-19 Thread Lialie KingMax
Hi, all I am writing a C extension with .Net. Now I have a list of points, like [(0.0, 0.0), (2.0, 3.0), (random x, random y)]. Is there a better way to translate it to an array than doing it one by one? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Embedding Python in C++ Problem

2006-05-09 Thread gavinpaterson
Dear Pythoners, I am trying to embed a Python script into a C++ application for the first time. Although I have used the example 5.3 Pure Embedding I am having problems with calling the function defined in my program. If I define function multiply in module "multiply.py" def multiply(a,b):

Re: Python in C integration and WxPython

2005-09-15 Thread Alain Paschoud
Hi David, Thanks for your answer, but I don't think the problem comes from which Python version I use. I installed the Python from cygwin, but this didn't change everything. Finally, I fullfill the PYTHONPATH environment variable to make the system finding the wx module. It is now able to find it

Re: Python in C integration and WxPython

2005-09-15 Thread David Wilson
It sounds like your C program and Python script are running under different interpreters. Your C program almost certainly is using a Python version that comes with Cygwin, while the script is probably using a native win32 Python that has wxPython installed. Assuming this is true, then compiling yo

Python in C integration and WxPython

2005-09-15 Thread Alain Paschoud
Hi all, I made a small dialog in WxPython. I can run the python script with a double-click or through command line, and everything goes fine (dialog appears, which means that wx module has been found). Then, I decided to write a C program (under Windows, with Cygwin) that will read my script (thro

Re: embedding python in C, working but with exception at the end

2005-09-03 Thread jepler
I see a couple of problems. First, because I'm using Unix, where filenames are case-sensitive, I had to '#include "Python.h"' instead of '#include "python.h"'. Next, it looks like the behavior that '.' is placed on sys.path isn't done automatically when embedding. So I had to set the environment

Re: embedding python in C, working but with exception at the end

2005-09-03 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Program crashes at line Py_Finalize(). Program tries to read some >memory location and suffer run time exception. PyTuple_SetItem "steals" a reference, so changing Py_XDECREF(stringarg); Py_XDECREF(args); to just Py_XDECREF(args); might fix the problem.

embedding python in C, working but with exception at the end

2005-09-03 Thread brobigi
well I manage to figure it out myself. I'm using Bloodshed Dev-cpp Here's the code: #include "python.h" #include int main(int argc, char* argv[]) { double answer = 0; PyObject *modname, *mod, *mdict, *func, *stringarg, *args, *rslt; Py_Initialize(); modname = PyStri

Embedding threaded Python in C

2005-08-21 Thread Richard
I've tried embedding Python in a C app so that Threading is done in the Python side. In the simple example below, unless I uncomment the ALLOW_THREADS macros, the Python thread does nothing until the C for-loop finishes. My real-world example is a large C/Motif application - apart from scatterin

Re: Embedding Python in C, undefined symbol: PyExc_FloatingPointError

2005-08-17 Thread en.karpachov
On Wed, 17 Aug 2005 14:29:43 +0800 Simon Newton wrote: > The C program is being built like so: > > gcc main.c -c -I-I/usr/include -I/usr/include -I/usr/include/python2.4 > -I/usr/include/python2.4 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes > gcc main.o -L/usr/lib -lpthread -ldl -lutil > -lm /us

Re: Embedding Python in C, undefined symbol: PyExc_FloatingPointError

2005-08-17 Thread Simon Newton
On Wed, 2005-08-17 at 09:52 +0200, "Martin v. Löwis" wrote: > Simon Newton wrote: > > gcc main.c -c -I-I/usr/include -I/usr/include -I/usr/include/python2.4 > > -I/usr/include/python2.4 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes > > gcc main.o -L/usr/lib -lpthread -ldl -lutil > > -lm /usr/lib/pyt

Re: Embedding Python in C, undefined symbol: PyExc_FloatingPointError

2005-08-17 Thread Martin v. Löwis
Simon Newton wrote: > gcc main.c -c -I-I/usr/include -I/usr/include -I/usr/include/python2.4 > -I/usr/include/python2.4 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes > gcc main.o -L/usr/lib -lpthread -ldl -lutil > -lm /usr/lib/python2.4/config/libpython2.4.a -o main > > I've tried the above on two

Embedding Python in C, undefined symbol: PyExc_FloatingPointError

2005-08-16 Thread Simon Newton
Hi, I've just starting out embedding Python in C and get the following error when I try and import a module that in turn imports the math module. ImportError: /usr/lib/python2.4/lib-dynload/math.so: undefined symbol: PyExc_FloatingPointError The module is as follows: # begin script.py i

Re: Embedding python in C

2005-06-28 Thread Philippe C. Martin
Thanks, I cannot get the demo to compile, but I joined their list. Thanks Philippe Chris Lambacher wrote: > pyrex can be used for embedding too. > http://www.freenet.org.nz/python/embeddingpyrex/ > > On 6/28/05, Philippe C. Martin <[EMAIL PROTECTED]> wrote: >> Actually maybe not ... looking

Re: Embedding python in C

2005-06-28 Thread Chris Lambacher
pyrex can be used for embedding too. http://www.freenet.org.nz/python/embeddingpyrex/ On 6/28/05, Philippe C. Martin <[EMAIL PROTECTED]> wrote: > Actually maybe not ... looking at the doc: > > I have modules already coded in Python, and I need a C wrapper so C > applications may link with it. >

Re: Embedding python in C - newbie

2005-06-28 Thread Philippe C. Martin
Sorry, it is still not clear when I reread it: 1) I have a bunch of Python working modules 2) I need to compile "something" so external C applications can access 1) Thanks, Philippe Philippe C. Martin wrote: > Just to make sure i'm clear as I've been told about swig and pyrex: I > don't want

  1   2   >