Attempting to import wx in python_d.exe I get an ImportError
import _core_
ImportError: DLL load failed: The specified module could not be found.
No indication of which DLL is missing.
A more pressing problem is that importing wx into python.exe fails
intermittently. If it imports it seems to work reliably, I haven't had
any program crashes once the GUI is displayed. But ... I've just
repeatedly run the following command from the command line. (Don't be
alarmed by the cygwin path - I prefer working in a bash shell and
using my cygwin home directory avoids directory names with spaces
which upset most of the build tools but everything is compiled using
MinGW tools in a cmd.exe window)
C:\cygwin\home\gregh\stuff\wxPython>python -c "import wx"
C:\cygwin\home\gregh\stuff\wxPython>python -c "import wx"
C:\cygwin\home\gregh\stuff\wxPython>python -c "import wx"
C:\cygwin\home\gregh\stuff\wxPython>python -c "import wx"
C:\cygwin\home\gregh\stuff\wxPython>python -c "import wx"
C:\cygwin\home\gregh\stuff\wxPython>python -c "import wx"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\cygwin\home\gregh\wxPython-src-2.9.2.4\wxPython\wx
\__init__.py", line
45, in <module>
from wx._core import *
File "C:\cygwin\home\gregh\wxPython-src-2.9.2.4\wxPython\wx
\_core.py", line 16
647, in <module>
from _misc import *
File "C:\cygwin\home\gregh\wxPython-src-2.9.2.4\wxPython\wx
\_misc.py", line 4,
in <module>
import _misc_
ImportError: DLL load failed: Invalid access to memory location.
The exception is accompanied by an error dialog box. Same addresses
each time.
The instruction at "0x63196b3e" referenced memory at "0x64986034".
The memory could not be "read".
I've also compiled the embedded.cpp source from the wxPython
subversion repo. It runs more often than not but occasionally exits
without displaying the GUI but with no error message. I've profiled it
using an interesting tool I found called DependencyWalker -
http://www.dependencywalker.com/
The program generates a full tree of all the external dependencies,
their dependencies and so on and also allows me to profile the running
program. There are a lot of heap errors, always immediately after
loading wxPython PYD files. Calling RtlFreeHeap with an invalid
address can't be a good thing and probably explains the intermittent
nature of the failure.
Loaded "_CORE_.PYD" at address 0x6F240000. Successfully hooked
module.DllMain(0x6F240000, DLL_PROCESS_ATTACH, 0x00000000) in
"_CORE_.PYD" called.HEAP[EMBEDDED.EXE]: Invalid Address specified to
RtlFreeHeap( 00A50000, 00BBFB78 )HEAP[EMBEDDED.EXE]: Invalid Address
specified to RtlFreeHeap( 00A50000, 00BC2C18 )HEAP[EMBEDDED.EXE]:
Invalid Address specified to RtlFreeHeap( 00A50000,
00BB6E48 )HEAP[EMBEDDED.EXE]: Invalid Address specified to
RtlFreeHeap( 00A50000, 00BC2D50 )DllMain(0x6F240000,
DLL_PROCESS_ATTACH, 0x00000000) in "_CORE_.PYD" returned 1 (0x1).
Perhaps I'm doing something wrong building wxPython? Maybe the setup.h
and build.cfg provided with my wxWidgets build don't reflect the
actual build settings? I build wxPython by setting WXWIN, PATH and
PYTHONPATH and then invoking setup.py like this ...
python setup.py COMPILER=mingw32 BUILD_GLCANVAS=0 BUILD_ACTIVEX=0 USE_SWIG=1 SWIG="C:\SWIG-1.3.29\SWIG.exe" WX_CONFIG="C:\wxWidgets-2.9.2\bin\wx-config.exe" MONOLITHIC=1 build_ext --inplace --force
I add --debug for a debug build.
I have uninstalled all other builds of wxWidgets, wxPython and Python
to avoid any DLL conflicts.
Any suggestions would be greatly appreciated. This is obviously very
close to working. I'm particularly pleased to see the embedded example
working. wxPython sharing a common event loop with a wxWidgets program
all compiled using gcc is potentially very useful, if I can just get
it to run consistently.