No module named 'scriptforge'

Hi,

I’m trying to code my first python macro for Calc with ScriptForge. But I get an error that says that there’s no ‘scriptforge’ module:

A Scripting Framework error occurred while running the Python script vnd.sun.star.script:sf_test.py$hello?language=Python&location=user.

Message: <class 'ImportError'>: No module named 'scriptforge' (or 'scriptforge.CreateScriptService' is unknown)
  File "/usr/lib/libreoffice/program/pythonscript.py", line 1057, in getScript
    mod = self.provCtx.getModuleByUrl( fileUri )
  File "/usr/lib/libreoffice/program/pythonscript.py", line 494, in getModuleByUrl
    exec(code, entry.module.__dict__)
  File "/home/roger/.config/libreoffice/4/user/Scripts/python/sf_test.py", line 1, in <module>
    from scriptforge import CreateScriptService
  File "/usr/lib/libreoffice/program/uno.py", line 428, in _uno_import
    raise uno_import_exc
  File "/usr/lib/libreoffice/program/uno.py", line 351, in _uno_import
    return _builtin_import(name, *optargs, **kwargs)

This is the code:

from scriptforge import CreateScriptService
doc = CreateScriptService("Calc")

def hello(args=None):
    doc.MsgBox("Hello!")

Do I have to install it from somewhere? I couldn’t find any documentation for installation.

I’m on Manjaro Linux.

Cheers

Scriptforge is a scam. 100 wrapper routines solve 100 problems out of 10,000. Just use this API as is.

3 Likes

Hello,

Probably using wrong LO version. Need at least v7.2.x

Reference → The ScriptForge Library