| Store | Cart

[C++-sig] Cannot import the Hello World module of Boost.Python's QuickStart in python

From: Heng Zhou <hzh...@clemson.edu>
Thu, 25 May 2017 00:54:16 -0400
I followed the steps in the QuickStart of Boost.Python here:
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.boost.org_doc_libs_1-5F49-5F0_libs_python_doc_tutorial_doc_html_index.html&d=DwIBaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=jSyKml46sQcyHEvdXhVDNwoCqN0MBfWgTmJFqTljZKM&m=6Z-RP-Mjs781YKE08gvO6owK6zMqGXD7ZRueaJHfUNo&s=2-beQ7RazSZIfAiaWI9QGvRv_EumlzP0E6iD2Qfmntg&e= .
I can successfully compile, link and get the output dll file, but I always
got and error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named hello_ext

when trying to import it in python. This is my environment:

- Windows 7 Enterprise SP1 64 bit, I am the Administrator and run cmd as
Administrator.
- Python 2.7.13 64 bit
- Visual Studio 2015 (v14.0) Update 3
- In VS2015, the project name is ConsoleApplication1, so the output is
ConsoleApplication1.dll.
- I built the simple sample code under x64 configuration in VS2015 and I
verified with dumpbin that the output ConsoleApplication1.dll is really 64
bit.

I tried the following but got the same error:
- I added the search path to the ConsoleApplication1.dll into sys.path
- I changed the name of ConsoleApplication1.dll to hello_ext.dll

The QuickStart says "The resulting DLL is now visible to Python." but that
magic does not take place on my machine. Could you please tell me what I
had missed or, if I built the DLL properly, how to import it in python
command line? Thanks a lot.

_______________________________________________
Cplusplus-sig mailing list
Cplu...@python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig

Recent Messages in this Thread
Heng Zhou May 25, 2017 04:54 am
Heng Zhou May 26, 2017 05:32 am
Messages in this thread