<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">


<META content="MSHTML 6.00.2800.1498" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#99cccc>
<DIV><SPAN class=819502306-18062005><FONT face=Arial color=#0000ff size=2>In 
general, finalizing and re-initializing Python has a number of issues - these 
functions were not designed to be called that way.</FONT></SPAN></DIV>
<DIV><SPAN class=819502306-18062005><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=819502306-18062005><FONT face=Arial color=#0000ff 
size=2>(Please try and send plain-text mails to this list (for some reason my 
mailer refuses to even switch my reply back to plain-text))</FONT></SPAN></DIV>
<DIV><SPAN class=819502306-18062005><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=819502306-18062005><FONT face=Arial color=#0000ff 
size=2>Mark</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> 
  python-win32-bounces@python.org [mailto:python-win32-bounces@python.org]<B>On 
  Behalf Of </B>arthur<BR><B>Sent:</B> Friday, 17 June 2005 7:18 
  PM<BR><B>To:</B> python-win32@python.org<BR><B>Subject:</B> [python-win32] Can 
  not import win32ui module the second time!<BR><BR></FONT></DIV>
  <DIV><FONT size=2>Hello everyone,</FONT></DIV>
  <DIV><FONT size=2>&nbsp;&nbsp;&nbsp; I embed python 2.4 in MFC application, 
  and call PyRun_SimpleString function to import win32ui module,</FONT></DIV>
  <DIV><FONT size=2>but it fails after undergoing a python initialize and 
  cleanup process. The error info is :</FONT></DIV>
  <DIV><FONT size=2>"System Error: dynamic module not initialized properly".If 
  anyone know the reason,please tell me,thanks.</FONT></DIV>
  <DIV><FONT size=2></FONT>&nbsp;</DIV>
  <DIV><FONT size=2>The following is the code section:</FONT></DIV>
  <DIV><FONT size=2>void Test()</FONT></DIV>
  <DIV><FONT size=2>{</FONT></DIV>
  <DIV><FONT size=2>&nbsp;&nbsp;&nbsp; Py_Initialize();</FONT></DIV>
  <DIV><FONT size=2>&nbsp;&nbsp;&nbsp;&nbsp;PyRun_SimpleString("import 
  win32ui");</FONT></DIV>
  <DIV><FONT size=2>&nbsp;&nbsp;&nbsp; Py_Finalize();</FONT></DIV>
  <DIV><FONT size=2></FONT>&nbsp;</DIV>
  <DIV><FONT size=2>&nbsp;&nbsp;&nbsp; Py_Initialize();</FONT> 
  <DIV><FONT size=2>&nbsp;&nbsp;&nbsp;&nbsp;PyRun_SimpleString("import 
  win32ui");</FONT></DIV>
  <DIV><FONT size=2>&nbsp;&nbsp;&nbsp; Py_Finalize();</FONT></DIV></DIV>
  <DIV><FONT size=2>}</FONT></DIV>
  <DIV><FONT size=2>The first call to PyRun_SimpleString will success,but the 
  second will fail.</FONT></DIV>
  <DIV><FONT size=2></FONT>&nbsp;</DIV>
  <DIV><FONT size=2>Arthur</FONT></DIV></BLOCKQUOTE></BODY></HTML>