libreoffice-code-highlighter icon indicating copy to clipboard operation
libreoffice-code-highlighter copied to clipboard

Fedora: Scripting Framework error

Open evacchi opened this issue 6 years ago • 12 comments

When I select the menu item:

A Scripting Framework error occurred while running the Python script vnd.sun.star.script:codehighlighter.oxt|python|highlight.py$highlight_js_default?language=Python&location=user:uno_packages.

Message: <class 'KeyError'>: 'codehighlighter.oxt'
  File "/usr/lib64/libreoffice/program/pythonscript.py", line 993, in getScript
    self.provCtx.uriHelper.getStorageURI(scriptUri) );
  File "/usr/lib64/libreoffice/program/pythonscript.py", line 381, in getStorageUrlFromPersistentUrl
    package = self.mapPackageName2Path[ packageName ]

pygments is installed

evacchi avatar Mar 13 '18 20:03 evacchi

Hi, How did you install code highlighter? Did you use .oxt file or .zip file from GitHub releases?

slgobinath avatar Mar 13 '18 21:03 slgobinath

Hi, I downloaded from libreoffice extension website, I've also tried to download oxt from github, to the same effect. It looks like Python support should be installed, I could run the Hello World macro... what else can I check?

evacchi avatar Mar 14 '18 07:03 evacchi

It also has dependencies with libreoffice-script-provider-python. Most of the times it comes with LO. Please make sure that you have this package.

slgobinath avatar Mar 14 '18 09:03 slgobinath

unfortunately there is no such package on fedora. I did install libreoffice-pyuno which should be the same, though

evacchi avatar Mar 14 '18 10:03 evacchi

In Fedora the python script provider for libreoffice is libobasis6.0-python-script-provider, not that one you put as a dependency. Please, add this one to dependencies, because all RedHat-derivated distros use this one.

ruben1981 avatar May 18 '18 12:05 ruben1981

SOLVED: just copy Pygments directory that you have in Python installation on your system, once you've installed it by pip, from the address "/usr/lib/pythonx.x.x/site-packages/" to "/path/to/libreoffice/program/python-core-x.y.z/lib/site-packages". NB1: create the directory "site-packages" if there isn't in your libreoffice "../python-core-x.y.z/lib" directory; NB2: Python version in LO hasn't to necessarily be the same than systemwide installed Python), so don't worry about it: just take Pygments from wherever you want. NB3: you have to open a file manager in root mode. If you have KDE use Konqueror, because Dolphin can't be started in root mode due to some asspaining security feature ??? Profit

ruben1981 avatar May 25 '18 19:05 ruben1981

hi @ruben1981 where is "/path/to/libreoffice/program/python-core-x.y.z/lib/site-packages"? I don't find it in openSUSE where it should be in around /usr/lib64/libreoffice/program/ there's no python-core folder

baddwin avatar Aug 03 '18 02:08 baddwin

@ruben1981 's solution worked for me!

Callum-25252 avatar Feb 04 '20 09:02 Callum-25252

I installed via Windows 10 with build 18362. I had an issue that was basically the same thing but it was referring to different lines on the python script mentioned. I can't replicate the exact issue now since I got it to work.

Anyway, another thing to mention like what @ruben1981 said, I'm assuming you also need the .oxt file in the same directory as the dependencies within the ...python-core-x.y.z\lib\site-packages\ folder.

So it should be under the path ...\LibreOffice\program\python-core-x.y.z\lib\site-packages\

And within that directory, it should be your pygments dependencies you downloaded, and codehighlighter.oxt.

Once I did that, my error went away and I was golden from there.

colelamers avatar Feb 14 '20 20:02 colelamers

"/path/to/libreoffice/program/python-core-x.y.z/lib/site-packages"

@ruben1981 Which path is this? I couldn't find anything like that in my /usr. I'm using standard LibreOffice installation from ArchLinux, but I believe paths should be the same as in some Ubuntu.

gnull avatar Nov 19 '20 15:11 gnull

I have also this problem in Ubuntu 20.10: Screenshot from 2021-01-15 13-56-19 I wonder, why? I followed all steps and install all the required packages using commands:

sudo apt install libreoffice-writer
sudo apt install libreoffice-script-provider-python python3-pip
sudo pip3 install pygments
pip3 install pygments

It used to work fine. Don't know what happened. LO: 7.0.3.1

#help

Edit: Judging by the above discussion, I have this to say: I have two folders:

  1. /usr/share/libreoffice/program
  2. /usr/lib/libreoffice/program

None of them include, python-core-x.y.z\lib\site-packages subfolder. Should I create one? Then where? In lib or share.

PranavBhattarai avatar Jan 15 '21 08:01 PranavBhattarai

I have also this problem in Ubuntu 20.10: Screenshot from 2021-01-15 13-56-19 I wonder, why? I followed all steps and install all the required packages using commands:

sudo apt install libreoffice-writer
sudo apt install libreoffice-script-provider-python python3-pip
sudo pip3 install pygments
pip3 install pygments

It used to work fine. Don't know what happened. LO: 7.0.3.1

#help

Edit: Judging by the above discussion, I have this to say: I have two folders:

  1. /usr/share/libreoffice/program
  2. /usr/lib/libreoffice/program

None of them include, python-core-x.y.z\lib\site-packages subfolder. Should I create one? Then where? In lib or share.

Same here on Mint 20.1, but I could notice that when downloading this extension from libre office's website, the name was weird ea4db15f_codehighlighter.oxt I just renamed to codehighlighter.oxt, removed and re-installed and now everything is fine. I hope this helps.

Also had to use same commands: sudo apt install libreoffice-writer sudo apt install libreoffice-script-provider-python python3-pip sudo pip3 install pygments pip3 install pygments

bobylapointe69300 avatar Mar 05 '21 09:03 bobylapointe69300