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 -

android - IBM Worklight 6.1 [Application Error] There was a network error (file:///android_asset/www/index.html) -