Python scripts not working when building CODE from source

My scripts are working when building from package, but not from source.
Here is the docker file I use after building CODE using from-source-gh-action/Dockerfile

FROM imagem/code:latest

# Default: no
ARG fromSource

# UTF-8 locale is needed to handle file names with non-ASCII characters
ENV LC_CTYPE C.UTF-8

USER root

RUN apt-get update && apt-get install -y wget && \
    wget -q https://collaboraoffice.com/downloads/gpg/collaboraonline-release-keyring.gpg -O /usr/share/keyrings/collaboraonline-release-keyring.gpg
	
COPY ./collaboraonline.sources /etc/apt/sources.list.d/collaboraonline.sources

RUN apt update && \
    apt install -y collaboraofficebasis-python-script-provider collaboraofficebasis-pyuno

COPY ./python_scripts/PSweb.py /opt/collaboraoffice/share/Scripts/python

COPY --chown=104:106 fonts /usr/share/fonts/truetype/more/
COPY --chown=104:106 fonts /opt/cool/systemplate/usr/share/fonts/truetype/more/


EXPOSE 9980

USER 100

I’m getting this error in the browser’s console when calling python scripts:

{“MessageId”:“CallPythonScript-Result”,“SendTime”:1738936681609,“Values”:{“commandName”:“vnd.sun.star.script:PSweb.py$removeSelectedComment?language=Python&location=share”,“success”:false,“result”:{“type”:“string”,“value”:“ScriptProtocolHandler::dispatch: caught com.sun.star.script.provider.ScriptFrameworkErrorException: <class ‘pythonscript.com.sun.star.ucb.InteractiveAugmentedIOException’>: an error occurred during file opening at /home/imagem/psweb/collabora/docker/from-source/builddir/core/ucbhelper/source/provider/cancelcommandexecution.cxx:84\n File "/lo/program/pythonscript.py", line 1058, in getScript\n mod = self.provCtx.getModuleByUrl( fileUri )\n File "/lo/program/pythonscript.py", line 472, in getModuleByUrl\n lastRead = self.sfa.getDateTimeModified( url )\n”},“wasModified”:false,“startUnixTimeMics”:3105494967957,“saveDurationMics”:1480591}}

Hii @mrenaud

It looks like the Python script handler is failing to locate or access your script.

Check File Path & Location

Your Dockerfile copies PSweb.py to:

/opt/collaboraoffice/share/Scripts/python

But your script call uses:

vnd.sun.star.script:PSweb.py$removeSelectedComment?language=Python&location=share
  • Verify if the script actually exists in /opt/collaboraoffice/share/Scripts/python inside the running container:
docker exec -it <container_id> ls -l /opt/collaboraoffice/share/Scripts/python/

If it’s missing, the copy might not be working.