-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a function to extract intrinsic typed variables from python int…
…o C++
- Loading branch information
Chris Sullivan
committed
Apr 19, 2016
1 parent
3b51734
commit f9276a1
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <vector> | ||
#include <iostream> | ||
#include <string> | ||
#include <pylingual.hpp> | ||
|
||
int main(){ | ||
|
||
try{ | ||
|
||
pylingual py; | ||
|
||
py.call("x = 42"); | ||
auto x = py.get<double>("x"); | ||
cout << x << endl; | ||
|
||
return 0; | ||
|
||
|
||
}catch(boost::python::error_already_set const &){ | ||
//Parse and output the exception | ||
string perror_str = parse_python_exception(); | ||
cout << "Error in Python: " << perror_str << endl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters