1

I've a weird problem. I'm setting up a project with an embedded Python interpreter. I've rebuilt Python from the sources (3.3.2) and then copied the Python libs as well as the .DLL into my application redistribution folder.

The weird stuff is that, while I'm being able to import a .py module, my recompiled interpreter fails to import a .pyd custom-built file. The same file imports file launching the interpreter from a Python regular distribution.

This is my code:

Py_SetPythonHome((wchar_t *)wideBasePath.c_str());
Py_InitializeEx(0);
PyRun_SimpleString("import MClientAPI");

It fails stating unable to find MClientAPI, while I have a _MClientAPI.pyd file available. I've tried to move it either under site-packages, libs or the root folder with no difference.

Any advice?

2
  • 1
    Importing MClientAPI won't load _MClientAPI.pyd, it'll load MClientAPI.pyd. Do you have a pure python implementation which loads the _ version and then fails to itself called MClientAPI.py? That's the normal reason for such a naming scheme. Commented Jun 11, 2013 at 12:45
  • Sorry that was a typo error. Even using import _MClientAPI fails.. Commented Jun 11, 2013 at 14:36

1 Answer 1

2

Well I discovered that, if you want to import a pyd file and you're in debug mode, no matter what you type, Python will always look for a _d postfixed file, in my case MClientAPI_d.pyd

Sign up to request clarification or add additional context in comments.

2 Comments

Is the '_d' requirement documented somewhere? I've spent the better part of the morning scratching my head on this.
Never found a documented thing about that, have to solve it alone :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.