Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #3315

Re: Is it possible to execute Python code from C++ without writing to a file?

From Anssi Saari <as@sci.fi>
Newsgroups comp.lang.python
Subject Re: Is it possible to execute Python code from C++ without writing to a file?
Date 2011-04-16 15:01 +0300
Message-ID <vg3r592ievr.fsf@pepper.modeemi.fi> (permalink)
References <mailman.404.1302912976.9059.python-list@python.org>

Show all headers | View raw


Roger House <rhouse@sonic.net> writes:

> I tried PyRun_String, but I can't see how it can be used to return a
> tuple (the Py_file_input option always returns None).

There's an example of this at
http://stackoverflow.com/questions/3789881/create-and-call-python-function-from-string-via-c-api

The comments say this took quite a lot of investigation. I believe it
too, since it doesn't exactly leap out from the documentation... The
example returns only a single fixed integer, but changing it to return
a tuple shouldn't be a problem.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar


Thread

Is it possible to execute Python code from C++ without writing to a file? Roger House <rhouse@sonic.net> - 2011-04-15 16:46 -0700
  Re: Is it possible to execute Python code from C++ without writing to a file? Anssi Saari <as@sci.fi> - 2011-04-16 15:01 +0300

csiph-web