Issue 93084

Summary: OS X build does not ship with Python and pyuno does not work with native python
Product: porting Reporter: ptsefton <pt>
Component: MacOSXAssignee: ericb
Status: CLOSED IRREPRODUCIBLE QA Contact: issues@porting <issues>
Severity: Trivial    
Priority: P3 CC: darabos.daniel, issues, jsc, lohmaier
Version: OOO300m3Keywords: oooqa
Target Milestone: ---   
Hardware: Mac   
OS: Mac OS X, all   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on: 71327    
Issue Blocks:    

Description ptsefton 2008-08-25 06:08:48 UTC
Since version 2.0 no Mac build of OOo has shipped with Python but the pyuno that
comes with OOo will not work with native versions on OS X.

Can we please get this resolved. Ideally, there should be a version of Python
with OOo so that it is independent of the user's installed Python. As it
standard there is no way to run Python code (AFAIK) even though samples are
shipped with the product.
Comment 1 moxfox 2008-08-27 21:15:30 UTC
Python comes with OSX:
/System/Library/Frameworks/Python.framework
Comment 2 ptsefton 2008-08-28 00:35:46 UTC
Yes, Python comes with OS X but it does not work with pyuno and never has AFAIK
that's why Python used to be included in the OpenOffice 2.0 download. I think
that it would be risky to rely on the system python in case people upgrade it too.

On the 3.0.0 Beta on OS X (Intel) build 9328 the Tools / Macros / Organize
Macros / Python... Dialog does not work - you  can't add or run a Python macro. 


If it works for you can you please tell us how to (a) run Python macros and (b)
use pyuno to automate OpenOffice.org. At the moment we are forced to use the
python that came with OOo 2.0 to run pyuno on the ICE project.
<http://ice.usq.edu.au>

Here's what I get on X 10.5.

cd /Applications/OpenOffice.org.app/Contents/basis-link/program/
Q07-0230:program sefton$ python python
pythonloader.py         pythonloader.pyc        pythonloader.uno.dylib 
pythonloader.unorc      pythonscript.py
Q07-0230:program sefton$ python pythonloader.
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python:
can't open file 'pythonloader.': [Errno 2] No such file or directory
Q07-0230:program sefton$ python
Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyuno
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap
Q07-0230:program sefton$ 
Comment 3 ptsefton 2008-08-28 00:37:30 UTC
Sorry - that copy and paste was a bit of a mess. But see what happens when you
try to run the python loader.

 python pythonloader.py
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap
Comment 4 eric.bachard 2008-08-28 00:39:23 UTC
FYI, there is a python25 cws in progress.

It has been created long time ago, and  the resync has been reloaded recently. 

Please be patient.

Comment 5 ptsefton 2008-08-28 01:36:35 UTC
Happy to be patient. Thanks for responding.

What do you mean by "there is a python25 cws in progress".

Does this mean that some time in the future OOo for the Mac will include Python
again or you will make it work with the native python. I think that even if it
does work with the native Python it would be good to include it like you used
otherwise there will be problems with different versions of OS X and if a user
updates their Python for some reason.

Also, are there any plans for a pyuno distribution that does not depend on the
whole of OOo?
Comment 6 moxfox 2008-08-28 07:55:39 UTC
OSX comes with Python 2.5, while OOo/pyuno is currently using only 2.3. So
there's probably some compatibility issues.

Using system provided python (in OSX) is just fine, because that is what happens
on Linux distributions as well.

For cws python25 the progress is described in issue 71327. For cws details, see:
http://eis.services.openoffice.org/EIS2/cws.ShowCWS?Path=SRC680%2Fpython25
Comment 7 eric.bachard 2008-08-28 08:07:20 UTC
@mox

- OpenOffice.org Python baseline will become 2.5 soon
- The current baseline is Tiger, and I only found Python 2.3.5 :
- The demand is important (and growing), so we'll have to find a solution. 

Looking at my installation (Tiger), I got:

[ordinateur-de-eric-b-2:Python.framework/Versions/2.3] ericb% [ordinateur-de-eric-b-
2:Python.app/Contents/MacOS] ericb% ./Python
Python 2.3.5 (#1, Aug 19 2006, 21:31:42) 
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

-> means the only available bversion is 2.3.5 -> won't work very soon.

But maybe I'm wrong, and maybe you can confirm Python 2.5 is shipped with Tiger ? Else, I'm afraid 
we'll have to support our internal version (means  the OOo Python for a while) . 

Compromise:  do that until we stop to support Tiger. 


What do you think ?




Comment 8 moxfox 2008-08-28 08:21:45 UTC
I don't know about Tiger. My system is Leopard. No comments to any plans
concerning compatibility with Tiger.


btw. For my own build of OOo/Aqua (m29), some of the python/pyuno is working ok,
at least initially tested:
- in Contents/basis-link/program
- python pythonloader.py                   --- loads fine
- python
Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyuno                           --- no errors
>>>     

Also while there were some issues, some of the commands also worked from here:
http://udk.openoffice.org/python/python-bridge.html

Probably cws python25 is still needed for full functionality.

As I don't know python at all, I'll leave this issue to others to handle.
Comment 9 shaunmcdonald131 2008-08-28 21:50:45 UTC
If I remember correctly, maho is using Tiger for building, so that there is the backward compatibility.
Comment 10 bill_janssen 2008-12-07 05:47:41 UTC
Tiger has, and will always have, Python 2.3.5.  Leopard (OS X 10.5) has, and
will always have, Python 2.5.  You need to have different binary modules (.so,
.dylib, whatever) for each of these.  If you build with the system Python
/usr/bin/python on Tiger, it won't work on Leopard.  If you build with the
system Python on Leopard, it won't work on Tiger.

Please get this right in your build and testing procedures.  And please
understand that these are two different versions of Python.  You have to test on
both Tiger and Leopard to see if it works.

Happy to help with more info if necessary.
Comment 11 bill_janssen 2009-01-21 01:49:33 UTC
Why is this still unconfirmed?

I just tried 3.0.1rc2 on an Intel Mac running OS X 10.5.6, and it's still
broken.  To confirm, try downloading and running DocumentConverter.py from
http://www.artofsolving.com/opensource/pyodconverter, and running it.

The problem is that the pyuno.so library has been built against Python 2.3.5
(the "system Python" on OS X 10.4 "Tiger"), and won't work with Python 2.5.x
(the system Python on OS X 10.5 "Leopard").

There are a number of ways to solve this issue.  Probably the most correct is to
have separate OO builds for OS X 10.4 and 10.5.  The minor version number in OS
X is actually what most OS builds would consider a major version number, and
there are a number of incompatibilities between the two.

A second option would be to ship a version of Python 2.3.5 along with OO, so
that all scripts would use that, instead of the "system Python".  Not a good
solution, IMO.
Comment 12 molnium 2009-02-15 20:19:26 UTC
*** Issue 93084 has been confirmed by votes. ***
Comment 13 danaronson 2009-05-11 19:45:43 UTC
is anyone working on this?  
Comment 14 lohmaier 2010-03-27 22:25:30 UTC
python works in current versions of OOo on Mac, with system python. Thus I 
consider this as workforme.

Also Lopard and Snow Leopard can run python 2.3, so no problem here.


python2.5 (that would have to be shipped with OOo, and of course increase 
download size, etc) another issue exists, thus doesn't make sense to keep this 
one.
Comment 15 lohmaier 2010-03-27 22:26:23 UTC
closing.

Shipped python samples run on both Tiger/PPC as well as Snow Leopard/Intel.
Comment 16 danaronson 2010-03-30 06:33:54 UTC
It doesn't seem to work for me:

dan-aronsons-macbook-2:matinee dan$ export
PYTHONPATH=/Applications/OpenOffice.org.app/Contents/basis-link/program/
dan-aronsons-macbook-2:matinee dan$ uname -a
Darwin dan-aronsons-macbook-2.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul
15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
dan-aronsons-macbook-2:matinee dan$ /usr/bin/python
Python 2.5.1 (r251:54863, Feb  6 2009, 19:02:12) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import uno
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap
Comment 17 emk1024 2010-04-06 21:43:26 UTC
I can confirm that this is still broken in OpenOffice.org 3.2.0 build 9483 on 
Leopard.

$ ls /usr/bin/python*
/usr/bin/python			/usr/bin/python2.5-config
/usr/bin/python-config		/usr/bin/pythonw
/usr/bin/python2.5		/usr/bin/pythonw2.5
$ /usr/bin/python --version
Python 2.5.1
$ /usr/bin/python2.5 --version
Python 2.5.1
$ cd /Applications/OpenOffice.org.app/Contents/basis-link/program
$ /usr/bin/python pythonloader.py 
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap
$ /usr/bin/python2.5 pythonloader.py 
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap
$ sudo port install python python24
$ python --version
Python 2.6.4
$ python pythonloader.py
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap
$ python2.4 pythonloader.py
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap

What's going on here:

1) Different versions of MacOS X ship with different versions of python. Leopard, 
for example, ships with Python 2.5.1. No Python 2.3 is available, and it can only 
be installed if you build it from source. This is actually rather hard to do, 
because of various sorts of bit rot.

2) MacPorts, a port system generally only used by programmers and power 
users, only supplies Python 2.4 through Python 2.6, none of which work.

3) No Python executable is included with OpenOffice 3.2.

Does anybody have any simple instructions which will get this working? If not, I 
believe we should re-open this bug.
Comment 18 lohmaier 2010-04-06 23:24:15 UTC
still works for me.
You can run the supplied python samples (e.g. Tools|Macros → run macros → OOo 
Macros → python sample → table sampe → Create table)

As you all agree: OOo doesn't ship with its own python interpreter. Thus the 
supplied macros are executed using the system's python interpreter.

This works on all supported Versions of Mac OSX (10.4.x, 10.5.x, 10.6.x), on PPC 
and on Intel.

Everything else, i.e. how to use your system's python manually to use pyuno is 
out of scope of this issue and should be better clarified on the mailinglists.

Apple is notorious for breaking backwards compatibility in its tools, loves to 
put a spoke in so.'s wheel with all little annoyances. 

Anyway: As OOo manages to setup a environment that satisfies system python, and 
you can add macros to OOo that make use of pyuno, Pyuno/python support in OOo 
itself is not broken. Mac OSX 10.6, 10.5, 10.4 all come with the necessary 
libraries, python stuff to use pyuno.

Bug again: How to call python so it will work is more suited for a mailinglist.