Hello everyone
I'm on winxp sp2 using python 2.4.5 unicode, wxpython 2.8.7.1 unicode and
vs2003...
I'm embedding python in a non opensource application which only lets me to
embed it in a dll. I call these 3 functions in my dll to:
1- initialize python (initpython in pydll.cpp).
2- import wx and start a wx app in a separate thread (startshell).
3- terminate the wx app and finalize python (deinitpython).
Everything works fine for the first time (python initialize/shell start/
shell terminate/ python finalize) But after a while I realized that I need
to reinitialize python and start all over again.
The second time I try to start the above process I get traceback [1] in the
middle of startshell function.
The problem is that I have no control over loading and unloading my dll
Which means that the dll stays attached to the application process after
step 3 and somehow it becomes the source of evil the second time I try to
start python and ...!
The attachment is a zip file containing 'embedT' project that emulates the
application and 'pydll' project, a minimal version of my dll that produces
the traceback. Unzip them in a folder and build the projects separately.
I will be the most grateful person on earth if you guide me!
Best regards,
Mani
PS: Extend 'st' (sleep time) if you get some weird thread errors!
[1]:
Traceback (most recent call last):
File "C:\Python24\lib\site-packages\wx-2.8-msw-unicode\wx\py\shell.py",
line 1416, in OnUpdateUI
if id in (wx.ID_CUT, wx.ID_CLEAR):
AttributeError: 'NoneType' object has no attribute 'ID_CUT'
Traceback (most recent call last):
File "C:\Python24\lib\site-packages\wx-2.8-msw-unicode\wx\_misc.py", line
1341, in Notify
self.notify()
File "C:\Python24\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line
14470, in Notify
self.result = self.callable(*self.args, **self.kwargs)
File "C:\Python24\lib\site-packages\wx-2.8-msw-unicode\wx\_windows.py",
line 1071, in SplitVertically
return _windows_.SplitterWindow_SplitVertically(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "wxThread::IsMain()" failed at
..\..\src\msw\evtloop.cpp(244) in wxEventLoop::Dispatch(): only the main
thread can process Windows messages Traceback (most recent call last):
File "C:\Python24\lib\site-packages\wx-2.8-msw-unicode\wx\py\shell.py",
line 1416, in OnUpdateUI
if id in (wx.ID_CUT, wx.ID_CLEAR):
AttributeError: 'NoneType' object has no attribute 'ID_CUT'
vcproj.zip (4.79 KB)