[Pythonmac-SIG] pythonw and python with applescript

Zhi Peng zhiyong_peng2003 at yahoo.com
Thu Dec 15 03:23:29 CET 2005

Thanks, Chris
  I will send my simple example to you later on 

Christopher Barker <Chris.Barker at noaa.gov> wrote:
  On Tuesday 13 December 2005 7:24 pm, Zhi Peng wrote:
> I would like
> to have a small C code and then compile and linked as dynamic library so
> that it can be imported by python code as we had in Linux platform.

Are you doing exactly the same thing on OS-X and Linux? Are you using 
distutils to compile your *.so? If so, it should work.

> Mac terminal looks like unix/linux, but there are some difference, which
> I may not know enough.

The differences, as far as this is concerned, are:

* that OS-X requires different flags and what not for compiling and linking -- 
distutils should take care of that for you

* Any GUI program needs to be run from inside an application bundle. This is 
true for pure C / C++ programs as well. For Python, pythonw does that for 

> In C code, all argumnet, parameters have to be 
> changed to in PyObject form, otherwise, python code may not be able to call
> the function.

This makes it sound like you are doing more than trying to get an extension 
that works on Linux to work on the mac. Yes, extensions can only recieve and 
return PyObjects to/from Python code, but inside your extension you jsut 
write regular old C.

SWIG is one way to generate code that translates C types into PyObjects. You 
can also do it by hand (or use pyrex, Boost::python, SIP, etc.).

> Not sure if anyone trys swig utility on other platform?

I've used it on Linux only, but it certainly works on OS-X. wxPython is built 
with it, for a large-scale example!

> on 
> swig home page, there is an example, it might work on linux/unix. But it
> does not work well on Mac as I tried it.

post that example, if we are to help you, that's exactly what we need, a 
simple example. And post exactly what you did to compile it!


Christopher Barker, Ph.D.

NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker at noaa.gov
Pythonmac-SIG maillist - Pythonmac-SIG at python.org

Yahoo! Shopping
 Find Great Deals on Holiday Gifts at Yahoo! Shopping 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051214/9e213157/attachment.htm

More information about the Pythonmac-SIG mailing list