i'd like my app to be "available" to python while it's running. for example, say my app is "FooBar.app". when my FooBar.app is running, now there is a python interface available to python, and the user can write python scripts to make use of it with their scripts, they can control my running application when FooBar.app is NOT running, perhaps making use of any of the python functions of "FooBar.app" would either return an error, or possibly launch "FooBar.app". can boost::python help with this? i've never worked with extending or embedding python, so any help would be super great
On 20 July 2013 00:36, David M. Cotter
i'd like my app to be "available" to python while it's running.
for example, say my app is "FooBar.app".
when my FooBar.app is running, now there is a python interface available to python, and the user can write python scripts to make use of it with their scripts, they can control my running application
when FooBar.app is NOT running, perhaps making use of any of the python functions of "FooBar.app" would either return an error, or possibly launch "FooBar.app".
can boost::python help with this?
i've never worked with extending or embedding python, so any help would be super great
I honestly suggest you to read through this chapter thoroughly and understand it what embedding and extending is at Python C API level first: http://docs.python.org/3/extending/index.html For your use case, you will need to apply the "Extending Embedded Python". The fact that you want to use Boost.Python is IMHO secondary, you will simply use convenient C++ API for Python, but it won't free you completely from understanding how the Python emb/ext machinery works. Yes, Boost Python can help with this: http://wiki.python.org/moin/boost.python/EmbeddingPython http://members.gamedev.net/sicrane/articles/EmbeddingPythonPart1.html Best regards, -- Mateusz Loskot, http://mateusz.loskot.net
Okay, for now let's skip the thing about "it should work when my app isn't running", just assume it's going to be embedded. For Mac, I understand i need to "create" (?) a python.dylib, but i find no directions for that at the expected location: http://docs.python.org/2/extending/embedding.html is there some wiki page explaining how to create this for use in MacOS / Xcode? Now for Windows: same thing, i think i must create a .dll, right? Is there a tutorial for that? After that, i can link to these items, then in my C++ app, just #include "Python.h" and i've covered step 1.
On 24 July 2013 06:18, David M. Cotter
Now for Windows: same thing, i think i must create a .dll, right? Is there a tutorial for that?
http://docs.python.org/2/extending/windows.html This is off-topic discussion here on Boost ml, which is dedicated to Boost development. Please, switch to Boost Users [1] with further questions. [1] http://www.boost.org/community/groups.html#users Best regards, -- Mateusz Loskot, http://mateusz.loskot.net
on Wed Jul 24 2013, Mateusz Loskot
On 24 July 2013 06:18, David M. Cotter
wrote: Now for Windows: same thing, i think i must create a .dll, right? Is there a tutorial for that?
http://docs.python.org/2/extending/windows.html
This is off-topic discussion here on Boost ml, which is dedicated to Boost development. Please, switch to Boost Users [1] with further questions.
http://www.boost.org/community/groups.html#cplussig is more appropriate for Boost.Python stuff -- Dave Abrahams
David, On 07/24/2013 01:18 AM, David M. Cotter wrote:
Okay, for now let's skip the thing about "it should work when my app isn't running", just assume it's going to be embedded.
For Mac, I understand i need to "create" (?) a python.dylib, but i find no directions for that at the expected location:
http://docs.python.org/2/extending/embedding.html
is there some wiki page explaining how to create this for use in MacOS / Xcode?
Now for Windows: same thing, i think i must create a .dll, right? Is there a tutorial for that?
After that, i can link to these items, then in my C++ app, just #include "Python.h" and i've covered step 1.
You might find the following boost.python documentation useful: http://www.boost.org/doc/libs/1_54_0/libs/python/doc/tutorial/doc/html/pytho... http://www.boost.org/doc/libs/1_54_0/libs/python/doc/v2/exec.html Stefan -- ...ich hab' noch einen Koffer in Berlin...
participants (4)
-
Dave Abrahams
-
David M. Cotter
-
Mateusz Loskot
-
Stefan Seefeld