title: Boost Python Hello World example not working in Python, AGAIN
body: <p>I have the same problem than the guy here</p>
  
  <p><a href="https://stackoverflow.com/questions/11036319/boost-python-hello-world-example-not-working-in-python">Boost Python Hello World example not working in Python</a></p>
  
  <p>who solved his problem, without indicating how. The posts there being quite old, after having posted there also, I create now a new question here, for refreshing things a bit. So... :</p>
  
  <p>My configuration : <strong>windows 8 62bits</strong>, python 2.7.3 32 bits, visual studio 2010 ultimate</p>
  
  <p>I followed</p>
  
  <p><a href="http://www.boost.org/doc/libs/1_53_0/libs/python/doc/tutorial/doc/html/python/exposing.html" rel="nofollow noreferrer">http://www.boost.org/doc/libs/1_53_0/libs/python/doc/tutorial/doc/html/python/exposing.html</a></p>
  
  <p>I have created a win32application project called CLIB in visual studio, and ticked "dll" but not "export symbols".</p>
  
  <p>In VC++ directories in properties I put : </p>
  
  <p>C:\Python27x86\include;C:\boost\boost_1_53_0;$(IncludePath)</p>
  
  <p>for include directories and </p>
  
  <p>C:\boost\boost_1_53_0\stage\lib;C:\Python27x86\libs;$(LibraryPath)</p>
  
  <p>for library directories.</p>
  
  <p>In CLIB.cpp I put</p>
  
  <pre><code>// CLIB.cpp : Defines the exported functions for the DLL application.
  //
  
  #include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;boost/python.hpp&gt;
  
  using namespace boost::python;
  
  struct World
  {
      void set(std::string msg) { this-&gt;msg = msg; }
      std::string greet() { return msg; }
      std::string msg;
  };
  
  BOOST_PYTHON_MODULE(hello)
  {
      boost::python::class_&lt;World&gt;("World")
          .def("greet", &amp;World::greet)
          .def("set", &amp;World::set)
          ;
  }
  </code></pre>
  
  <p>I tried with or without adding</p>
  
  <pre><code>#define BOOST_PYTHON_STATIC_LIB
  </code></pre>
  
  <p>Then I compiled in debug mode (with success), the output .dll (or .pyd, I have tried both without any success by modifying the target extension from .dll to .pyd in "general" in "configuration properties" of the project) CLIB.dll is in a directory whose path I added to the PYTHONPATH also. I have even tried to put a blank <strong>init</strong>.py in the same directory than the dll, and, whatever I do, I am not able to do a</p>
  
  <pre><code>import hello
  </code></pre>
  
  <p>in the python script (created from fresh either with notepad++ or with pyscripter 32 bits). So if someone could give precise help, that would be perfect.</p>
  
  <p>Thx a lot.</p>
  
  <p>////////////////////////// EDIT 1 ///////////////////////////</p>
  
  <p>In the meantime I saw python 2.7 was compiled with mvs2008, so erase everything, installed python 3.3, rebuilt boost and boost.python with python 3.3, and retried, but... same result...</p>
  
  <p>////////////////////////// EDIT 2 ///////////////////////////</p>
  
  <p>As suggested a run the python script with the very verbose -vv command, here is the result :</p>
  
  <pre><code>PS C:\Users\TheUser\Desktop\CLIB\Release&gt; python -vv .\script.py
  import _frozen_importlib # frozen
  import imp # builtin
  import sys # builtin
  # installing zipimport hook
  import 'zipimport' # &lt;class '_frozen_importlib.BuiltinImporter'&gt;
  # installed zipimport hook
  # C:\Python33x86\Lib\encodings\__pycache__\__init__.cpython-33.pyc matches C:\Python33x86\Lib\encodings\__init__.py
  # code object from C:\Python33x86\Lib\encodings\__pycache__\__init__.cpython-33.pyc
  # C:\Python33x86\Lib\__pycache__\codecs.cpython-33.pyc matches C:\Python33x86\Lib\codecs.py
  # code object from C:\Python33x86\Lib\__pycache__\codecs.cpython-33.pyc
  import '_codecs' # &lt;class '_frozen_importlib.BuiltinImporter'&gt;
  import 'codecs' # &lt;_frozen_importlib.SourceFileLoader object at 0x01E50870&gt;
  # C:\Python33x86\Lib\encodings\__pycache__\aliases.cpython-33.pyc matches C:\Python33x86\Lib\encodings\aliases.py
  # code object from C:\Python33x86\Lib\encodings\__pycache__\aliases.cpython-33.pyc
  import 'encodings.aliases' # &lt;_frozen_importlib.SourceFileLoader object at 0x01E91B90&gt;
  import 'encodings' # &lt;_frozen_importlib.SourceFileLoader object at 0x01E503F0&gt;
  # C:\Python33x86\Lib\encodings\__pycache__\mbcs.cpython-33.pyc matches C:\Python33x86\Lib\encodings\mbcs.py
  # code object from C:\Python33x86\Lib\encodings\__pycache__\mbcs.cpython-33.pyc
  import 'encodings.mbcs' # &lt;_frozen_importlib.SourceFileLoader object at 0x01E9E730&gt;
  # C:\Python33x86\Lib\encodings\__pycache__\utf_8.cpython-33.pyc matches C:\Python33x86\Lib\encodings\utf_8.py
  # code object from C:\Python33x86\Lib\encodings\__pycache__\utf_8.cpython-33.pyc
  import 'encodings.utf_8' # &lt;_frozen_importlib.SourceFileLoader object at 0x01E9E8D0&gt;
  # C:\Python33x86\Lib\encodings\__pycache__\latin_1.cpython-33.pyc matches C:\Python33x86\Lib\encodings\latin_1.py
  # code object from C:\Python33x86\Lib\encodings\__pycache__\latin_1.cpython-33.pyc
  import 'encodings.latin_1' # &lt;_frozen_importlib.SourceFileLoader object at 0x01E9E9B0&gt;
  # C:\Python33x86\Lib\__pycache__\io.cpython-33.pyc matches C:\Python33x86\Lib\io.py
  # code object from C:\Python33x86\Lib\__pycache__\io.cpython-33.pyc
  # C:\Python33x86\Lib\__pycache__\abc.cpython-33.pyc matches C:\Python33x86\Lib\abc.py
  # code object from C:\Python33x86\Lib\__pycache__\abc.cpython-33.pyc
  # C:\Python33x86\Lib\__pycache__\_weakrefset.cpython-33.pyc matches C:\Python33x86\Lib\_weakrefset.py
  # code object from C:\Python33x86\Lib\__pycache__\_weakrefset.cpython-33.pyc
  import '_weakrefset' # &lt;_frozen_importlib.SourceFileLoader object at 0x01EA7150&gt;
  import 'abc' # &lt;_frozen_importlib.SourceFileLoader object at 0x01E9EC30&gt;
  import 'io' # &lt;_frozen_importlib.SourceFileLoader object at 0x01E9EB10&gt;
  # C:\Python33x86\Lib\encodings\__pycache__\cp850.cpython-33.pyc matches C:\Python33x86\Lib\encodings\cp850.py
  # code object from C:\Python33x86\Lib\encodings\__pycache__\cp850.cpython-33.pyc
  import 'encodings.cp850' # &lt;_frozen_importlib.SourceFileLoader object at 0x01EA7F50&gt;
  # C:\Python33x86\Lib\__pycache__\site.cpython-33.pyc matches C:\Python33x86\Lib\site.py
  # code object from C:\Python33x86\Lib\__pycache__\site.cpython-33.pyc
  # C:\Python33x86\Lib\__pycache__\os.cpython-33.pyc matches C:\Python33x86\Lib\os.py
  # code object from C:\Python33x86\Lib\__pycache__\os.cpython-33.pyc
  import 'errno' # &lt;class '_frozen_importlib.BuiltinImporter'&gt;
  # C:\Python33x86\Lib\__pycache__\stat.cpython-33.pyc matches C:\Python33x86\Lib\stat.py
  # code object from C:\Python33x86\Lib\__pycache__\stat.cpython-33.pyc
  import 'stat' # &lt;_frozen_importlib.SourceFileLoader object at 0x01EBD190&gt;
  # C:\Python33x86\Lib\__pycache__\ntpath.cpython-33.pyc matches C:\Python33x86\Lib\ntpath.py
  # code object from C:\Python33x86\Lib\__pycache__\ntpath.cpython-33.pyc
  # C:\Python33x86\Lib\__pycache__\genericpath.cpython-33.pyc matches C:\Python33x86\Lib\genericpath.py
  # code object from C:\Python33x86\Lib\__pycache__\genericpath.cpython-33.pyc
  import 'genericpath' # &lt;_frozen_importlib.SourceFileLoader object at 0x01EBDE50&gt;
  import 'ntpath' # &lt;_frozen_importlib.SourceFileLoader object at 0x01EBDAD0&gt;
  # C:\Python33x86\Lib\collections\__pycache__\__init__.cpython-33.pyc matches C:\Python33x86\Lib\collections\__init__.py
  # code object from C:\Python33x86\Lib\collections\__pycache__\__init__.cpython-33.pyc
  # C:\Python33x86\Lib\collections\__pycache__\abc.cpython-33.pyc matches C:\Python33x86\Lib\collections\abc.py
  # code object from C:\Python33x86\Lib\collections\__pycache__\abc.cpython-33.pyc
  import 'collections.abc' # &lt;_frozen_importlib.SourceFileLoader object at 0x027C3FB0&gt;
  import '_collections' # &lt;class '_frozen_importlib.BuiltinImporter'&gt;
  import 'operator' # &lt;class '_frozen_importlib.BuiltinImporter'&gt;
  # C:\Python33x86\Lib\__pycache__\keyword.cpython-33.pyc matches C:\Python33x86\Lib\keyword.py
  # code object from C:\Python33x86\Lib\__pycache__\keyword.cpython-33.pyc
  import 'keyword' # &lt;_frozen_importlib.SourceFileLoader object at 0x027E1330&gt;
  # C:\Python33x86\Lib\__pycache__\heapq.cpython-33.pyc matches C:\Python33x86\Lib\heapq.py
  # code object from C:\Python33x86\Lib\__pycache__\heapq.cpython-33.pyc
  import 'itertools' # &lt;class '_frozen_importlib.BuiltinImporter'&gt;
  # C:\Python33x86\Lib\__pycache__\bisect.cpython-33.pyc matches C:\Python33x86\Lib\bisect.py
  # code object from C:\Python33x86\Lib\__pycache__\bisect.cpython-33.pyc
  import '_bisect' # &lt;class '_frozen_importlib.BuiltinImporter'&gt;
  import 'bisect' # &lt;_frozen_importlib.SourceFileLoader object at 0x027E1EF0&gt;
  import '_heapq' # &lt;class '_frozen_importlib.BuiltinImporter'&gt;
  import 'heapq' # &lt;_frozen_importlib.SourceFileLoader object at 0x027E1910&gt;
  # C:\Python33x86\Lib\__pycache__\weakref.cpython-33.pyc matches C:\Python33x86\Lib\weakref.py
  # code object from C:\Python33x86\Lib\__pycache__\weakref.cpython-33.pyc
  import 'weakref' # &lt;_frozen_importlib.SourceFileLoader object at 0x027E1950&gt;
  # C:\Python33x86\Lib\__pycache__\reprlib.cpython-33.pyc matches C:\Python33x86\Lib\reprlib.py
  # code object from C:\Python33x86\Lib\__pycache__\reprlib.cpython-33.pyc
  import 'reprlib' # &lt;_frozen_importlib.SourceFileLoader object at 0x027E9CF0&gt;
  import 'collections' # &lt;_frozen_importlib.SourceFileLoader object at 0x01EC0CD0&gt;
  # C:\Python33x86\Lib\__pycache__\copyreg.cpython-33.pyc matches C:\Python33x86\Lib\copyreg.py
  # code object from C:\Python33x86\Lib\__pycache__\copyreg.cpython-33.pyc
  import 'copyreg' # &lt;_frozen_importlib.SourceFileLoader object at 0x027EFD10&gt;
  import 'os' # &lt;_frozen_importlib.SourceFileLoader object at 0x01EB3130&gt;
  # C:\Python33x86\Lib\__pycache__\re.cpython-33.pyc matches C:\Python33x86\Lib\re.py
  # code object from C:\Python33x86\Lib\__pycache__\re.cpython-33.pyc
  # C:\Python33x86\Lib\__pycache__\sre_compile.cpython-33.pyc matches C:\Python33x86\Lib\sre_compile.py
  # code object from C:\Python33x86\Lib\__pycache__\sre_compile.cpython-33.pyc
  import '_sre' # &lt;class '_frozen_importlib.BuiltinImporter'&gt;
  # C:\Python33x86\Lib\__pycache__\sre_parse.cpython-33.pyc matches C:\Python33x86\Lib\sre_parse.py
  # code object from C:\Python33x86\Lib\__pycache__\sre_parse.cpython-33.pyc
  # C:\Python33x86\Lib\__pycache__\sre_constants.cpython-33.pyc matches C:\Python33x86\Lib\sre_constants.py
  # code object from C:\Python33x86\Lib\__pycache__\sre_constants.cpython-33.pyc
  import 'sre_constants' # &lt;_frozen_importlib.SourceFileLoader object at 0x028054F0&gt;
  import 'sre_parse' # &lt;_frozen_importlib.SourceFileLoader object at 0x027FD530&gt;
  import 'sre_compile' # &lt;_frozen_importlib.SourceFileLoader object at 0x01EB3690&gt;
  # C:\Python33x86\Lib\__pycache__\functools.cpython-33.pyc matches C:\Python33x86\Lib\functools.py
  # code object from C:\Python33x86\Lib\__pycache__\functools.cpython-33.pyc
  import '_functools' # &lt;class '_frozen_importlib.BuiltinImporter'&gt;
  import 'functools' # &lt;_frozen_importlib.SourceFileLoader object at 0x027FD8D0&gt;
  import 're' # &lt;_frozen_importlib.SourceFileLoader object at 0x01EBD5D0&gt;
  # C:\Python33x86\Lib\__pycache__\sysconfig.cpython-33.pyc matches C:\Python33x86\Lib\sysconfig.py
  # code object from C:\Python33x86\Lib\__pycache__\sysconfig.cpython-33.pyc
  import 'sysconfig' # &lt;_frozen_importlib.SourceFileLoader object at 0x0280D9F0&gt;
  # C:\Python33x86\Lib\__pycache__\locale.cpython-33.pyc matches C:\Python33x86\Lib\locale.py
  # code object from C:\Python33x86\Lib\__pycache__\locale.cpython-33.pyc
  import '_locale' # &lt;class '_frozen_importlib.BuiltinImporter'&gt;
  import 'locale' # &lt;_frozen_importlib.SourceFileLoader object at 0x0281B810&gt;
  # C:\Python33x86\Lib\encodings\__pycache__\cp1252.cpython-33.pyc matches C:\Python33x86\Lib\encodings\cp1252.py
  # code object from C:\Python33x86\Lib\encodings\__pycache__\cp1252.cpython-33.pyc
  import 'encodings.cp1252' # &lt;_frozen_importlib.SourceFileLoader object at 0x02825350&gt;
  import 'site' # &lt;_frozen_importlib.SourceFileLoader object at 0x01EA4290&gt;
  Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32
  Type "help", "copyright", "credits" or "license" for more information.
  import 'math' # &lt;class '_frozen_importlib.BuiltinImporter'&gt;
  Traceback (most recent call last):
    File ".\script.py", line 2, in &lt;module&gt;
      import CLIB
    File "&lt;frozen importlib._bootstrap&gt;", line 1558, in _find_and_load
    File "&lt;frozen importlib._bootstrap&gt;", line 1525, in _find_and_load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 586, in _check_name_wrapper
    File "&lt;frozen importlib._bootstrap&gt;", line 497, in set_package_wrapper
    File "&lt;frozen importlib._bootstrap&gt;", line 510, in set_loader_wrapper
    File "&lt;frozen importlib._bootstrap&gt;", line 1130, in load_module
    File "&lt;frozen importlib._bootstrap&gt;", line 313, in _call_with_frames_removed
  ImportError: DLL load failed: The specified module could not be found.
  </code></pre>