From: Bill Davy on
I am struggling :-(

I have used SWIG to build a module called SHIP. So I have a directory
containing and _SHIP.pyd, as follows:


Volume in drive H has no label.

Volume Serial Number is B83B-76F2

Directory of H:\Viper\HostPC\V1\SHIP\Release

05/07/2010 14:43 <DIR> .

05/07/2010 14:43 <DIR> ..

03/07/2010 16:28 41,079

03/07/2010 14:36 495,616 _SHIP.pyd

2 File(s) 536,695 bytes

2 Dir(s) 58,270,535,680 bytes free

I have a test Python program which imports sys and os and then attempts to
import SHIP; it begins as follows:

## D for John's notebook

## E for Rod's notebook

## H for Bill's notebook

DRIVE = 'H:'

import sys

import os

if ( not os.path.exists(DRIVE) ):

print "Drive \'%s\' does not exist on this machine; edit top of file" %


# Prepend our path

sys.path[:0] = [DRIVE + r'\Viper\HostPC\V1\SHIP\Release']

import SHIP


I then create a Command Prompt window and enter:

H:\Viper\HostPC\V1\SHIP>C:\Python26\python -vv >tmp.txt 2>&1

In tmp.txt, I see the following:

<snipped out lots of importing>

Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)]
on win32

Type "help", "copyright", "credits" or "license" for more information.

# trying H:\Viper\HostPC\V1\SHIP\Release\SHIP.pyd

# trying H:\Viper\HostPC\V1\SHIP\Release\

# H:\Viper\HostPC\V1\SHIP\Release\SHIP.pyc matches

import SHIP # precompiled from H:\Viper\HostPC\V1\SHIP\Release\SHIP.pyc

# trying H:\Viper\HostPC\V1\SHIP\Release\_SHIP.pyd

# clear[2] __name__

# clear[2] __file__

Traceback (most recent call last):

File "", line 15, in <module>

import SHIP

File "H:\Viper\HostPC\V1\SHIP\Release\", line 7, in <module>

import _SHIP

ImportError: DLL load failed: The specified module could not be found.


It would seem the "import SHIP" is finding without any trouble. begins by "import _SHIP".

Python appears to find H:\Viper\HostPC\V1\SHIP\Release\_SHIP.pyd but for
some reason, which I cannot fathom, says "DLL load failed".

Can anyone offer me any suggestion where I am going wrong or how to tackle
this problem?

Could it be that the Python 2.6 I am running did not use the same compiler
(VC6) with which I buiult _SHIP.pyd and if so, is there a way round this
without moving on from VC6?