[Pythonmac-SIG] Python embedding in LabVIEW on Mac? (oops, found part of the problem)

Jack Jansen Jack.Jansen@oratrix.com
Thu, 20 Jun 2002 22:09:36 +0200

On donderdag, juni 20, 2002, at 06:58 , Marcus H. Mendenhall wrote:
> OK, in response to my own post (sorry), I found an oops 
> involving calling Py_Initialize instead of PyMac_Initialize .  
> Now, LabVIEW gets much farther into the embedding startup, but 
> still doesn't quite work.  The remaining, important  question 
> is whether any has had this work under newer version of 
> LabVIEW, since the 5.0.1 release is quite old.

Calling PyMac_Initialize() in stead of Py_Initialize() is 
definitely needed when embedding MacPython. But even then there 
are probably pitfalls. Some I can think of:
- the two event loops (MacPython's and LabVIEW's) may get in 
each others way. Also, if you have windows open in both you may 
get a continuous stream of Update Events for a window which your 
event loop knows nothing about.
- Python may have problems with missing some of the resources it 
needs (to find the initial sys.path and other preferences and 
such). Check :Mac:Demo:embed.html for some of the details (but 
it is by no means complete).
- It may help to set Py_VerboseFlag to 1 (or 2 for even more 
output) before calling PyMac_Initialize. This'll give all sorts 
of debug output for importing modules and such. But: if your 
problem is eventloop/window/IO-system related this'll probably 
not work.
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- 
Emma Goldman -