Issue 88211

Summary: PyUNO broken in OOo 3.0 DEV300
Product: App Dev Reporter: aziem <ahz001>
Component: apiAssignee: joerg.skottke
Status: CLOSED FIXED QA Contact: issues <issues.openoffice.org>
Severity: trivial    
Priority: P2 CC: caolanm, issues, stephan.bergmann.secondary
Version: OOo 3.3 or older   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation on: ---
Developer Difficulty: ---

Description aziem 2008-04-12 23:02:21 UTC
Two PyUNO programs I've used in OOo 1.1.5 - OOo 2.4.0 no longer work in OOo 3.0
DEV300_m3 to DEV300_m6.  I even tested the PyUNO hello world.  Maybe I am doing
something stupid? :)

Attempt #1
1. Copy hello_world.py from http://udk.openoffice.org/python/python-bridge.html
2. /home/z/programs/ooo300_m6/openoffice.org3.0/program/soffice
"-accept=socket,host=localhost,port=2002;urp;StarOffice.ServiceManager"
-norestore -nofirststart -nologo -headless
3.  ~/programs/ooo300_m6/openoffice.org/basis3.0/program/python.sh /tmp/hello.py
Traceback (most recent call last):
  File "/tmp/hello.py", line 18, in ?
    model = desktop.getCurrentComponent()
AttributeError: getCurrentComponent


Attempt #2
1. Download http://www.artofsolving.com/opensource/pyodconverter
2. /home/z/programs/ooo300_m6/openoffice.org3.0/program/soffice
-accept="socket,port=8100;urp;"
3. /programs/ooo300_m6/openoffice.org/basis3.0/program/python.sh
/tmp/DocumentConverter.py /tmp/foo.odt /tmp/foo.doc
Traceback (most recent call last):
  File "/tmp/DocumentConverter.py", line 139, in ?
    converter.convert(argv[1], argv[2])
  File "/tmp/DocumentConverter.py", line 99, in convert
    document = self.desktop.loadComponentFromURL(inputUrl, "_blank", 0,
_unoProps(Hidden=True, ReadOnly=True))
AttributeError: loadComponentFromURL
Comment 1 jsc 2008-04-14 08:41:34 UTC
jsc -> sb: as discussed to you
Comment 2 Stephan Bergmann 2008-04-14 10:10:11 UTC
yet another victim of the new three-layer office
Comment 3 Stephan Bergmann 2008-05-07 13:27:52 UTC
fixed; as somewhat of a hack, added -env:INIFILEPATH=$sd_prog/redirectrc arg
when starting python.bin from python.sh, so that a later
defaultBootstrap_InitialComponentContext() will bootstrap into a complete OOo
UNO env
Comment 4 Stephan Bergmann 2008-05-09 15:56:05 UTC
#desc4 was by mistake; fixed correctly now (without hacks); on Unix there is
<brand-layer>/program/python shell script (no superfluous, extra python.sh any
longer), on Windows there is <brand-layer>\program\python.exe now (formerly
python.bat).
Comment 5 Stephan Bergmann 2008-05-14 08:52:16 UTC
@jsk: please verify
Comment 6 joerg.skottke 2008-05-21 12:38:12 UTC
Verified on Linux using the hello-world python sample.
Needed to make sure a writer document is open first and the script had to be
executed from the <brand>/program directory - "./python hello-world.py"
Comment 7 caolanm 2008-06-13 15:25:58 UTC
cmc->sb: What was the substantive part of this fix ? Trying to figure out how
(if possible) to fix the "using system python" case.
Comment 8 Stephan Bergmann 2008-06-13 16:12:06 UTC
@cmc: lets please continue at issue 90701
Comment 9 joerg.skottke 2008-09-15 14:03:44 UTC
Closed.