how to invoke python script in c++ code? -


in c++ application, want invoke python script processing works. have searched in google , found there 2 ways this:

    (1). use `system` command. this, `system('python myscript.py');`     (2). use `pyrun_simplestring("execfile('myscript.py')");` 

i want ask that, way better , there better way work?

thanks.

i want ask that, way better , there better way work?

you should notice python engine written in c , therefore provides native c-api. allows interact more directly python code, means of calling functions , using python objects.

if want integrate c++ code without hassling c-api, there's excellent , easy use boost::python library.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -