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?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!goblin3!goblin.stu.neva.ru!newsfeed2.funet.fi!newsfeeds.funet.fi!news.cc.tut.fi!not-for-mail
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 Sat, 16 Apr 2011 15:01:44 +0300
Lines 12
Message-ID <vg3r592ievr.fsf@pepper.modeemi.fi> (permalink)
References <mailman.404.1302912976.9059.python-list@python.org>
NNTP-Posting-Host pepper.modeemi.fi
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace news.cc.tut.fi 1302955304 20659 2001:708:310:3430:203:baff:fe7d:42dd (16 Apr 2011 12:01:44 GMT)
X-Complaints-To abuse@tut.fi
NNTP-Posting-Date Sat, 16 Apr 2011 12:01:44 +0000 (UTC)
User-Agent Gnus/5.101 (Gnus v5.10.10) Emacs/21.3 (usg-unix-v)
Cancel-Lock sha1:POnjj3/sRSYAOYFERuRzGN8t/us=
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:3315

Show key headers only | 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