slgobinath / libreoffice-code-highlighter

Code snippet highlighter for LibreOffice Writer, Calc and Impress.
https://extensions.libreoffice.org/extensions/code-highlighter
Other
133 stars 16 forks source link

Fedora: Scripting Framework error #25

Open evacchi opened 6 years ago

evacchi commented 6 years ago

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

slgobinath commented 6 years ago

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

evacchi commented 6 years ago

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?

slgobinath commented 6 years ago

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.

evacchi commented 6 years ago

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

ruben1981 commented 6 years ago

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 commented 6 years ago

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

baddwin commented 6 years ago

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

Callum-25252 commented 4 years ago

@ruben1981 's solution worked for me!

colelamers commented 4 years ago

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.

gnull commented 3 years ago

"/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.

PranavBhattarai commented 3 years ago

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.

bobylapointe69300 commented 3 years ago

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