#1189 swigwin-2.0.4 > python31 > PyInit__name s.b. PyInit_name

python (259)

swigwin-2.0.4 > python3.1 > PyInit__name s.b. PyInit_name
I swigged, built with MSVC 2008 / vc9, renamed Cearth.dll to .pyd, got pyd, your Cearth.py helper, and my testCearth.py
import Cearth
in one directory, and ran my test from IDLE
I got this error message:
Traceback (most recent call last):
File "C:\source\BlenderUpgrade\Cearth\Release\testCearth.py", line 1, in <module>
import Cearth
ImportError: dynamic module does not define init function (PyInit_Cearth)
I went back and edited/hacked the Cearth_wrap.c and found
Cearth_wrap.c Line 2937
# define SWIG_init PyInit__Cearth
It looks like it has 2 __
In Cearth_wrap.c if I change PyInit__Cearth to PyInit_Cearth, then testCearth.py (calling Cearth.py calling Cearth.pyd (.dll)) doesn’t bomb.
I'm able to continue.
Am I doing something wrong, or is that you?

my Cearth.i:
%module Cearth
/* Includes the header in the wrapper code */
#include "Cearth.h"

/* Parse the header file to generate wrappers */
%include "Cearth.h"


  • William Fulton

    William Fulton - 2012-08-15
    • assigned_to: nobody --> wsfulton
    • status: open --> closed-invalid
  • William Fulton

    William Fulton - 2012-08-15

    SWIG is generating the correct names. You need to build your dll as _Cearth.pyd. See "Hand compiling a dynamic module" in the SWIG Python chapter.


Log in to post a comment.