# Python scripts not working when building CODE from source

**URL:** <https://forum.collaboraonline.com/t/python-scripts-not-working-when-building-code-from-source/3321>\
**Category:** Installation & Configuration\
**Created:** [January 16, 2025, 4:39pm UTC](https://forum.collaboraonline.com/t/python-scripts-not-working-when-building-code-from-source/3321 "2025-01-16T16:39:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrenaud](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/mrenaud/32/174_2.png) [@mrenaud](https://forum.collaboraonline.com/u/mrenaud)\
**Post date:** [January 16, 2025, 4:39pm UTC](https://forum.collaboraonline.com/t/python-scripts-not-working-when-building-code-from-source/3321/1 "2025-01-16T16:39:56Z")

</div>

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

```auto
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

```

---

<div class="post-metadata">

**Author:** ![mrenaud](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/mrenaud/32/174_2.png) [@mrenaud](https://forum.collaboraonline.com/u/mrenaud)\
**Post date:** [February 7, 2025, 2:00pm UTC](https://forum.collaboraonline.com/t/python-scripts-not-working-when-building-code-from-source/3321/2 "2025-02-07T14:00:36Z")

</div>

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}}

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [February 11, 2025, 9:50am UTC](https://forum.collaboraonline.com/t/python-scripts-not-working-when-building-code-from-source/3321/3 "2025-02-11T09:50:38Z")

</div>

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:

```auto
/opt/collaboraoffice/share/Scripts/python

```

But your script call uses:

```auto
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:

```auto
docker exec -it <container_id> ls -l /opt/collaboraoffice/share/Scripts/python/

```

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

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [February 13, 2025, 9:37am UTC](https://forum.collaboraonline.com/t/python-scripts-not-working-when-building-code-from-source/3321/4 "2025-02-13T09:37:15Z")

</div>


