title: How to get Python exception text
body: <p>I want to embed python in my C++ application. I'm using Boost library - great tool. But i have one problem. </p>
  
  <p>If python function throws an exception, i want to catch it and print error in my application or get some detailed information like line number in python script that caused error.</p>
  
  <p>How can i do it? I can't find any functions to get detailed exception information in Python API or Boost.</p>
  
  <pre><code>try {
  module=import("MyModule"); //this line will throw excetion if MyModule contains an   error
  } catch ( error_already_set const &amp; ) {
  //Here i can said that i have error, but i cant determine what caused an error
  std::cout &lt;&lt; "error!" &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>PyErr_Print() just prints error text to stderr and clears error so it can't be solution</p>