Re: embedding interactive python interpreter

2013-09-11 Thread Eric Frederich
Scott, Yes. As Mark Hammond suggested I took a look into the code/console modules. I wound up using InteractiveConsole from the code module. I'm sure my requirements are completely different from yours but I'll explain what I did anyway... I was working with a client/server architecture where I

Re: embedding interactive python interpreter

2011-03-28 Thread Mark Hammond
On 28/03/2011 2:06 PM, Eric Frederich wrote: I'm not sure that I know how to run this function in such a way that it gives me an interactive session. I passed in stdin as the first parameter and NULL as the second and I'd get seg faults when running exit() or even imnport sys. I don't want to

Re: embedding interactive python interpreter

2011-03-27 Thread Mark Hammond
On 26/03/2011 4:37 AM, Eric Frederich wrote: So I found that if I type ctrl-d then the other lines will print. I think ctrl-d just causes sys.stdin to see EOF, so things just fall out as you desire. exit() will winf up causing the C exit() function after finalizing, hence the behaviour

Re: embedding interactive python interpreter

2011-03-27 Thread Eric Frederich
This is behavior contradicts the documentation which says the value passed to sys.exit will be returned from Py_Main. Py_Main doesn't return anything, it just exits. This is a bug. On Sun, Mar 27, 2011 at 3:10 AM, Mark Hammond mhamm...@skippinet.com.au wrote: On 26/03/2011 4:37 AM, Eric

Re: embedding interactive python interpreter

2011-03-27 Thread Jerry Hill
On Sun, Mar 27, 2011 at 9:33 AM, Eric Frederich eric.freder...@gmail.com wrote: This is behavior contradicts the documentation which says the value passed to sys.exit will be returned from Py_Main. Py_Main doesn't return anything, it just exits. This is a bug. Are you sure that calling the

Re: embedding interactive python interpreter

2011-03-27 Thread Eric Frederich
I'm not talking about the documentation for sys.exit() I'm talking about the documentation for Py_Main(int argc, char **argv) http://docs.python.org/c-api/veryhigh.html?highlight=py_main#Py_Main This C function never returns anything whether in the interpreter I type exit(123) or sys.exit(123).

Re: embedding interactive python interpreter

2011-03-27 Thread eryksun ()
On Friday, March 25, 2011 12:02:16 PM UTC-4, Eric Frederich wrote: Is there something else I should call besides exit() from within the interpreter? Is there something other than Py_Main that I should be calling? Does PyRun_InteractiveLoop also have this problem? --

Re: embedding interactive python interpreter

2011-03-27 Thread Mark Hammond
On 28/03/2011 5:28 AM, Eric Frederich wrote: I'm not talking about the documentation for sys.exit() I'm talking about the documentation for Py_Main(int argc, char **argv) http://docs.python.org/c-api/veryhigh.html?highlight=py_main#Py_Main This C function never returns anything whether in the

Re: embedding interactive python interpreter

2011-03-27 Thread Eric Frederich
I'm not sure that I know how to run this function in such a way that it gives me an interactive session. I passed in stdin as the first parameter and NULL as the second and I'd get seg faults when running exit() or even imnport sys. I don't want to pass a file. I want to run some C code, start

Re: embedding interactive python interpreter

2011-03-27 Thread eryksun ()
On Sunday, March 27, 2011 11:06:47 PM UTC-4, Eric Frederich wrote: I'm not sure that I know how to run this function in such a way that it gives me an interactive session. I passed in stdin as the first parameter and NULL as the second and I'd get seg faults when running exit() or even imnport

embedding interactive python interpreter

2011-03-25 Thread Eric Frederich
I am able to embed the interactive Python interpreter in my C program except that when the interpreter exits, my entire program exits. #include stdio.h #include Python.h int main(int argc, char *argv[]){ printf(line %d\n, __LINE__); Py_Initialize();

Re: embedding interactive python interpreter

2011-03-25 Thread Eric Frederich
So I found that if I type ctrl-d then the other lines will print. It must be a bug then that the exit() function doesn't do the same thing. The documentation says The return value will be the integer passed to the sys.exit() function but clearly nothing is returned since the call to Py_Main

Re: embedding interactive python interpreter

2011-03-25 Thread MRAB
On 25/03/2011 17:37, Eric Frederich wrote: So I found that if I type ctrl-d then the other lines will print. It must be a bug then that the exit() function doesn't do the same thing. The documentation says The return value will be the integer passed to the sys.exit() function but clearly

Re: embedding interactive python interpreter

2011-03-25 Thread Eric Frederich
Added a fflush(stdout) after each printf and, as I expectedstill only the first 2 prints. On Fri, Mar 25, 2011 at 1:47 PM, MRAB pyt...@mrabarnett.plus.com wrote: On 25/03/2011 17:37, Eric Frederich wrote: So I found that if I type ctrl-d then the other lines will print. It must be a

[issue6187] Improvement in doc of Extending and Embedding the Python Interpreter, 5.3 Beyond Very High Level Embedding: An overview

2010-08-01 Thread Mark Lawrence
Mark Lawrence breamore...@yahoo.co.uk added the comment: I don't see why this needs to be done, the 2nd paragraph of the doc is pretty explicit. This document assumes basic knowledge about Python. For an informal introduction to the language, see The Python Tutorial. The Python Language

[issue6187] Improvement in doc of Extending and Embedding the Python Interpreter, 5.3 Beyond Very High Level Embedding: An overview

2010-08-01 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: Agreed with Mark. -- resolution: - works for me status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6187 ___

Re: Problem with uuid package when embedding a python interpreter

2009-07-01 Thread Jérôme Fuselier
On Jun 30, 7:02 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Tue, 30 Jun 2009 13:05:42 -0300, Jérôme Fuselier jerome.fusel...@gmail.com escribió:   I've tried to import a script in an embedded python intrepreter but this script fails when it imports the uuid module. I have a

Re: Problem with uuid package when embedding a python interpreter

2009-07-01 Thread Aahz
In article 7d5cfbf0-38d5-4505-a93a-f321d0da7...@c36g2000yqn.googlegroups.com, =?ISO-8859-1?Q?J=E9r=F4me_Fuselier?= jerome.fusel...@gmail.com wrote: I've tried to import a script in an embedded python intrepreter but this script fails when it imports the uuid module. I have a segmentation fault

Problem with uuid package when embedding a python interpreter

2009-06-30 Thread Jérôme Fuselier
Hello, I've tried to import a script in an embedded python intrepreter but this script fails when it imports the uuid module. I have a segmentation fault in Py_Finalize(). Here is a simple program which imitate my problem. main.c : #include Python.h void test() { Py_Initialize();

Re: Problem with uuid package when embedding a python interpreter

2009-06-30 Thread Gabriel Genellina
En Tue, 30 Jun 2009 13:05:42 -0300, Jérôme Fuselier jerome.fusel...@gmail.com escribió: I've tried to import a script in an embedded python intrepreter but this script fails when it imports the uuid module. I have a segmentation fault in Py_Finalize(). #include Python.h void test() {

[issue6187] Improvement in doc of Extending and Embedding the Python Interpreter, 5.3 Beyond Very High Level Embedding: An overview

2009-06-03 Thread Jon Blubinger
: Improvement in doc of Extending and Embedding the Python Interpreter, 5.3 Beyond Very High Level Embedding: An overview versions: Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1 Added file: http://bugs.python.org/file14168/interp3.c ___ Python tracker rep

Re: Embedding the python interpreter

2007-08-30 Thread Tom Gur
On Aug 28, 4:03 pm, Grant Edwards [EMAIL PROTECTED] wrote: On 2007-08-28, Tom Gur [EMAIL PROTECTED] wrote: Hey, Do you know an easy way to embed the python interpreter in a python program (so a non-technical user, which has no idea how to install the python interpreter would be able to

Embedding the python interpreter

2007-08-28 Thread Tom Gur
Hey, Do you know an easy way to embed the python interpreter in a python program (so a non-technical user, which has no idea how to install the python interpreter would be able to run the script as an executable) ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedding the python interpreter

2007-08-28 Thread Python list
Hi, Do you mean something like py2exe? http://www.py2exe.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedding the python interpreter

2007-08-28 Thread penten
On Aug 28, 8:45 pm, Tom Gur [EMAIL PROTECTED] wrote: Hey, Do you know an easy way to embed the python interpreter in a python program (so a non-technical user, which has no idea how to install the python interpreter would be able to run the script as an executable) ? py2exe does this very

Re: Embedding the python interpreter

2007-08-28 Thread Grant Edwards
On 2007-08-28, Tom Gur [EMAIL PROTECTED] wrote: Hey, Do you know an easy way to embed the python interpreter in a python program (so a non-technical user, which has no idea how to install the python interpreter would be able to run the script as an executable) ? Hey, This question is asked

Problem embedding the Python interpreter and importing win32 extensions

2007-01-26 Thread paroutyj
I have been playing around with this issue for a while and seen some previous posting trying to address the problem but I haven't seen any answers to the problem so I am reposting it in my quest for a solution. I am using python 2.2.3, because I am using some dSpace software

Re: Problem embedding the Python interpreter and importing win32extensions

2007-01-26 Thread Gabriel Genellina
[EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] I am using python 2.2.3, because I am using some dSpace software (controldesk/automationdesk) that is based upon that version of python. I have some pre-compiled python modules that come with the dspace applications. I am pretty

[Fwd: Re: Embedding Multiplr Python interpreter in C++]

2005-01-14 Thread Steve Holden
Yogesh Sharma [EMAIL PROTECTED] wrote: one more question to add: Is there a way to have 2 local copies of python interpreter ? Yogesh Sharma wrote: Hi, I have following setup: OS Linux Fedora Core 3 Python 2.3.4 How can I embed two python interpreters in one C++ program ? Thanks Take

Embedding Multiplr Python interpreter in C++

2005-01-13 Thread Yogesh Sharma
Hi, I have following setup: OS Linux Fedora Core 3 Python 2.3.4 How can I embed two python interpreters in one C++ program ? Thanks -- http://mail.python.org/mailman/listinfo/python-list