Thanks. Good advice.<br><br>From the quickstart project, the embedded.cpp file function<br><br><br>void exec_file_test(std::string const &amp;script)<br>{<br>    std::cout &lt;&lt; &quot;running file &quot; &lt;&lt; script &lt;&lt; &quot;...&quot; &lt;&lt; std::endl;<br>
    <br>    // Run a python script in an empty environment.<br>    python::dict global;<br>    python::object result = python::exec_file(script.c_str(), global, global);<br><br>    // Extract an object the script stored in the global dictionary.<br>
    BOOST_TEST(python::extract&lt;int&gt;(global[&quot;number&quot;]) ==  42);<br>    <br>    std::cout &lt;&lt; &quot;success!&quot; &lt;&lt; std::endl;<br>}<br><br>calls my python script file - parseLogs.py which starts with <br>
<br>import os.path<br>import stat<br>import csv<br>import re<br>import pickle<br>import operator<br>import time<br>import msvcrt<br>from optparse import OptionParser<br>import sys<br><br>The &#39;import&#39; call throws the exception - ImportError: __import__ not found. I&#39;m looking into the PyInitialize() and how the interpreter gets loaded.<br>
<br>Thanks.<br><br><br><br><div class="gmail_quote">On Fri, Apr 3, 2009 at 1:55 PM, Stefan Seefeld <span dir="ltr">&lt;<a href="mailto:seefeld@sympatico.ca">seefeld@sympatico.ca</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">mad city wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Just starting out with boost-python. I have a python script that I want to call from C++ code. I have the quickstart example working. I&#39;m running into a problem. The python script I&#39;m calling includes import statements - for example &#39;import os&#39;, and these are causing an exception<br>

<br>
ImportError: __import__ not found  <br>
</blockquote>
<br></div>
Not having seen your code, I&#39;d suggest you start by looking at the existing tests that use the functionality you want. In this case, this means the &#39;import&#39; and &#39;exec&#39; tests in boost/libs/python/test.<br>

<br>
It&#39;s generally most likely to get help if you provide some details, such as a chunk of code that we could run to reproduce the issue.<br>
<br>
Regards,<br>
      Stefan<br><font color="#888888">
<br>
-- <br>
<br>
     ...ich hab&#39; noch einen Koffer in Berlin...<br>
<br>
_______________________________________________<br>
Cplusplus-sig mailing list<br>
<a href="mailto:Cplusplus-sig@python.org" target="_blank">Cplusplus-sig@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/cplusplus-sig" target="_blank">http://mail.python.org/mailman/listinfo/cplusplus-sig</a><br>
</font></blockquote></div><br>