![]() Second, I have to make sure to run the right Python and extend the PYTHONPATH correctly. I'm working with 64b MacPorts Python 3.3 and 64b LibreOffice for Mac ( download link) which comes with Python 3.3. First, I have to make sure that both Python and my LibreOffice are built for 32b or 64b they can't be mixed. Type "help", "copyright", "credits" or "license" for more information.īut here is what works for me. Things are a little bit more tricky here, and as of LibreOffice 4.3 I still can't extend my PYTHONPATH to LibreOffice and import uno without crashing on Mac: localhost ~ > PYTHONPATH=$PYTHONPATH:/Applications/LibreOffice64.app/Contents/MacOS python3.3 Note that the details of those env vars' values differ among LO versions.ĭirkjot's answer to this thread works great on Linux. UNO_PATH, URE_BOOTSTRAP, and the parts of PYTHONPATH that find the LO-specific libs (rather than those that come with python itself). To make PyUNO work from a different python you'll want to set up these env vars too, esp. It needs to set up a number of env vars (whose purpose is even documented in the script). One gross hack on Mac is to use install_name_tool to "rewire" libpyuno.dylib to reference the other python's amework/Versions/3.3/Python (by absolute path) instead of gotcha is that LO's python (on Linux and Mac) is actually a shell script around the true python executable. (This happens to work better on Linux, where libpyuno.so references libpython3.3m.so, and normally finds the LO python one's next to itself via its RPATH, but if any libpython3.3m.so happens to already be loaded into the process (from the other python), the Linux loader happily re-uses that one.) When run from a different python process than LO's, that means there'll be two python runtimes in the process (and the LO one not even properly initialized, probably), and that leads to a SEGV somewhere in that LibreOfficePython. The SEGV on Mac is because LO's libpyuno.dylib (loaded via libuno.dylib, which in turn is loaded via "import uno") references (run "otool -L" on that file path as on current LO master paths are a little different on various LO versions). Once you try to run PyUNO off any other python executable than the one provided with LO, things do get rough.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |