<DIV>Bob</DIV>  <DIV>&nbsp;</DIV>  <DIV>Actually there is only one step away, that is, pythonw and python. With python, I can import modules by using PyImport_ImportModule("name"). But I have to use pythonw since I used appscript. Then I can not import modules sucessfully with same commands.</DIV>  <DIV>&nbsp;</DIV>  <DIV>If converting C code to python, there will be a lot of changes too because C is strict typed language while python everything is&nbsp;Object. I have to make .so or&nbsp;.dylib in order to allow python code to call C code.&nbsp;That will be still a lot of work. &nbsp;</DIV>  <DIV>&nbsp;</DIV>  <DIV>Regards </DIV>  <DIV>&nbsp;</DIV>  <DIV>Zhi <BR><BR><B><I>Bob Ippolito &lt;bob@redivi.com&gt;</I></B> wrote:</DIV>  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">You don't have to change it all to Python, you just need to refactor it a bit.? Instead of embeding Python from C, you embed C from Python.? Of course, it's
 better to prefer Python code because there will be less of it, it's not always a good idea to just throw all the old code away.  <DIV><BR class=khtml-block-placeholder></DIV>  <DIV>-bob</DIV>  <DIV><BR>  <DIV>  <DIV>On Dec 13, 2005, at 12:46 PM, Zhi Peng wrote:</DIV><BR class=Apple-interchange-newline>  <BLOCKQUOTE type="cite">  <DIV>Hi! Bob </DIV>  <DIV>?</DIV>  <DIV>What you suggested is right. </DIV>  <DIV>?</DIV>  <DIV>The interesting thing is that I have a lot of old c code which will try to call python code. It is true that I can write pure python code and use py2app (I use py2exe on windows) to make an executable. That? will make life easy. But .. </DIV>  <DIV>?</DIV>  <DIV>I think that I need to do something as you said, try to change all C code to python, it may be easier than that I embeded python to C. </DIV>  <DIV>?</DIV>  <DIV>Thanks all .</DIV>  <DIV>?</DIV>  <DIV>Zhi </DIV>  <DIV>?</DIV>  <DIV><BR><BR><B><I>Bob Ippolito &lt;<A
 href="mailto:bob@redivi.com">bob@redivi.com</A>&gt;</I></B> wrote:</DIV>  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR>On Dec 13, 2005, at 12:18 PM, Zhi Peng wrote:<BR><BR>&gt; If we use pythonw, then there may be problem in C code to call the <BR>&gt; python code with appscript inside because it seems &gt; PyImport_ImportModule("ModuleName") only works with python instead <BR>&gt; of pythonw.<BR><BR>pythonw is just a shell script. You're embedding Python, it's not <BR>even an option. You must use an application bundle in order to <BR>communicate with WindowServer.<BR><BR>You probably shouldn't be embedding Python in the first place.. Much <BR>easier that way, because py2app can create the application bundle for <BR>you, and you don't have to deal with all of the initialization/ <BR>finalization for Python.<BR><BR>-bob<BR><BR><BR></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV><BR class=khtml-block-placeholder></DIV>  <HR SIZE=1> 
 Yahoo! Shopping<BR>Find Great Deals on Holiday Gifts at <A href="http://us.rd.yahoo.com/mail_us/footer/shopping/*http://shopping.yahoo.com/;_ylc=X3oDMTE2bzVzaHJtBF9TAzk1OTQ5NjM2BHNlYwNtYWlsdGFnBHNsawNob2xpZGF5LTA1">Yahoo! Shopping</A>  <DIV style="MARGIN: 0px">_______________________________________________</DIV>  <DIV style="MARGIN: 0px">Pythonmac-SIG maillist<SPAN class=Apple-converted-space>? </SPAN>-<SPAN class=Apple-converted-space>? </SPAN><A href="mailto:Pythonmac-SIG@python.org">Pythonmac-SIG@python.org</A></DIV>  <DIV style="MARGIN: 0px"><A href="http://mail.python.org/mailman/listinfo/pythonmac-sig">http://mail.python.org/mailman/listinfo/pythonmac-sig</A></DIV></BLOCKQUOTE></DIV><BR></DIV></BLOCKQUOTE>  <DIV><BR></DIV><p>
        
                <hr size=1>Yahoo! Shopping<br> 
Find Great Deals on Holiday Gifts at <a href="http://us.rd.yahoo.com/mail_us/footer/shopping/*http://shopping.yahoo.com/;_ylc=X3oDMTE2bzVzaHJtBF9TAzk1OTQ5NjM2BHNlYwNtYWlsdGFnBHNsawNob2xpZGF5LTA1 
">Yahoo! Shopping</a>