Bug 117202 - Error when passing arguments to a python function
Summary: Error when passing arguments to a python function
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
6.0.2.1 release
Hardware: All All
: medium normal
Assignee: Laurent Godard
URL:
Whiteboard: target:6.1.0
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-24 07:34 UTC by Laurent Godard
Modified: 2018-05-29 09:55 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
python script for testing (1.01 KB, text/x-python)
2018-04-24 14:59 UTC, Laurent Godard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent Godard 2018-04-24 07:34:49 UTC
One can launch python scripts using command line such as :

$ soffice 'vnd.sun.star.script:myLib/myModule.py$pyFunction?language=Python&location=user'

unfortunatelly, one can not pass arguments to `pyFunction`

expected :

be able to pass arguments and call like this

$ soffice 'vnd.sun.star.script:myLib/myModule.py$pyFunction(first, second, third)?language=Python&location=user'
Comment 1 Laurent Godard 2018-04-24 14:59:27 UTC
Created attachment 141597 [details]
python script for testing

copy the myModule.py file in `$(userEnv)/Scripts/python/myLib`

, $(userEnv) is typically `~/.config/libreoffice/4/user/`
this is the script that will be called by command line
Comment 2 Laurent Godard 2018-04-24 15:01:22 UTC
first patch proposed at https://cgit.freedesktop.org/libreoffice/core/commit/?h=private/lgodard/tdf%23117202&id=2f3a64081418db291f5dc9eb67aac23066f09b54

calling 

$ soffice 'vnd.sun.star.script:myLib/myModule.py$pyFunction(first, second, third)?language=Python&location=user'

should display a document ending with the list of passed arguments
Comment 3 Commit Notification 2018-04-24 23:37:18 UTC
Laurent Godard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=aa45e2745f14c5626fe163939dc7d101efe9d1cd

tdf#117202 - parse function name to get arguments

It will be available in 6.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Thorsten Behrens (allotropia) 2018-04-24 23:41:52 UTC
Small oddness - python scripts via script provider get an initial bool 'True' parameter passed via invoke(). Not sure if that's intentional, and it was clearly there already before this change.
Comment 5 Commit Notification 2018-04-27 07:10:09 UTC
Laurent Godard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3d97c9d292d80cb82391bdb416a9c6217a8e16e4

tdf#117202 more pythonic and allow spaces as argument

It will be available in 6.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Xisco Faulí 2018-05-29 09:35:12 UTC
A polite ping to Laurent Godard:
Is this bug fixed? if so, could you please close it as RESOLVED FIXED ? Otherwise, Could you please explain what's missing?
Thanks