# Issue Running a Python Script from Execute Command Node on DigitalOcean

**URL:** <https://community.n8n.io/t/issue-running-a-python-script-from-execute-command-node-on-digitalocean/8079>\
**Category:** Questions\
**Tags:** node\
**Created:** [25. September 2021 um 22:31 UTC](https://community.n8n.io/t/issue-running-a-python-script-from-execute-command-node-on-digitalocean/8079 "2021-09-25T22:31:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Davis\_Ancona](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/davis_ancona/32/3817_2.png) [@Davis\_Ancona](https://community.n8n.io/u/Davis_Ancona)\
**Post date:** [25. September 2021 um 22:31 UTC](https://community.n8n.io/t/issue-running-a-python-script-from-execute-command-node-on-digitalocean/8079/1 "2021-09-25T22:31:39Z")

</div>

I’m currently working on creating a workflow to allow me to run Python scripts via n8n. My instance is hosted on DigitalOcean and was set up by following this [video](https://www.youtube.com/watch?v=br91GmhMNxg).

I added Python to my server using this article for the [steps](https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-programming-environment-on-an-ubuntu-20-04-server) and then used a Bind Mount to make it available in my n8n Docker container. It is possible I set up Python in the incorrect folder, but when I type `docker inspect n8n` I can see the following

 ![Screen Shot 2021-09-25 at 3.15.29 PM](https://europe1.discourse-cdn.com/n8n/original/2X/f/f3ea8b02934bd0cc02d8cb0af002b1bf451aadf0.png)  
 ![Screen Shot 2021-09-25 at 3.15.13 PM](https://europe1.discourse-cdn.com/n8n/original/2X/9/9504b462b15b235fb34ab51eed65dc5a5059692f.png)

I can also see it in my /home/div folder, along with a simple Hello World file that I created after the fact.

 ![Screen Shot 2021-09-25 at 3.01.36 PM](https://europe1.discourse-cdn.com/n8n/original/2X/c/c715f707d9cef0853015e00e9a61ef9ba52183c5.png)

However, I can’t seem to get it to run…

 ![Screen Shot 2021-09-25 at 3.01.51 PM](https://europe1.discourse-cdn.com/n8n/original/2X/5/5779c3cd61666394e73f1e23d55123e3930af65a.png)

In the event it’s helpful, I’ve also been having issues with the Write to Binary node. I assume, I am missing something obvious regarding how to access local files from n8n. But despite browsing the existing posts the only thing to work for me was writing to /root/.n8n/ which I know is not correct.

Here is my docker.compose…

 ![Screen Shot 2021-09-25 at 12.31.08 PM](https://europe1.discourse-cdn.com/n8n/original/2X/5/569392516e961d22a47f0dea4e9fc1b1cf8e9e90.png)

And the error I am getting…

 ![Screen Shot 2021-09-25 at 3.07.27 PM](https://europe1.discourse-cdn.com/n8n/original/2X/3/3fc47ed05e3eb7ba1ebb8fce4390a686ed05f61e.png)

Any points in the right direction would be massively appreciated. Thank you!

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [25. September 2021 um 22:57 UTC](https://community.n8n.io/t/issue-running-a-python-script-from-execute-command-node-on-digitalocean/8079/2 "2021-09-25T22:57:16Z")

</div>

Look to me that n8n image does not have access to the python runtime. The container is not aware that you installed pyhon in the host. I think you have to create a custom image that adds python. Check the post below.

> [@Running Python with n8n](http://community.n8n.io/t/running-python-with-n8n/5715/3):
>
> Btw. if you want to build a docker-image with python you can extend the default n8n image and extend it. For that create a file name Dockerfile with this content: FROM n8nio/n8n RUN apk add --update python3 py3-pip And then run in the same folder the following command to build it: docker build -t n8n-python . If you then use this image, you will be able to run python scripts (be aware that you would have to use the command python3 and not python).

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [25. September 2021 um 23:09 UTC](https://community.n8n.io/t/issue-running-a-python-script-from-execute-command-node-on-digitalocean/8079/3 "2021-09-25T23:09:36Z")

</div>

With regard to the Write to Binary node I wonder if it’s related to the issue below. That would explain why it works with /root/.n8n. It seems like the base path has to be path of the .n8n folder.

> [@Path for storing / writing binary file on n8n cloud \[Write Binary File node \]](http://community.n8n.io/t/path-for-storing-writing-binary-file-on-n8n-cloud-write-binary-file-node/7383/2):
>
> Hello longwei, for the write node to work, you’ll have to start the file name with /home/node/.n8n/. For example, you want to save a file called image.png, in the write node’s file name field, you’ll have to enter /home/node/.n8n/image.png. Further, i’ll note down this issue and we’ll try to fix this as soon as possible. Feel free to write if it doesn’t work this way, and happy low-coding! –

---

<div class="post-metadata">

**Author:** ![Davis\_Ancona](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/davis_ancona/32/3817_2.png) [@Davis\_Ancona](https://community.n8n.io/u/Davis_Ancona)\
**Post date:** [25. September 2021 um 23:09 UTC](https://community.n8n.io/t/issue-running-a-python-script-from-execute-command-node-on-digitalocean/8079/4 "2021-09-25T23:09:50Z")

</div>

Got it. Thank you! I will try that. Is the path of the file still correct? For both the Execute Command and Write Binary File nodes shown?

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [25. September 2021 um 23:22 UTC](https://community.n8n.io/t/issue-running-a-python-script-from-execute-command-node-on-digitalocean/8079/5 "2021-09-25T23:22:35Z")

</div>

In the Write Binary File node try with `/home/node/.n8n/nameofthefile`.

For the execute command node, I’m not sure. But it will be a matter of testing once python is available in the container.

---

<div class="post-metadata">

**Author:** ![Davis\_Ancona](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/davis_ancona/32/3817_2.png) [@Davis\_Ancona](https://community.n8n.io/u/Davis_Ancona)\
**Post date:** [26. September 2021 um 23:04 UTC](https://community.n8n.io/t/issue-running-a-python-script-from-execute-command-node-on-digitalocean/8079/6 "2021-09-26T23:04:43Z")

</div>

Got Python and the write to binary to work! Thanks @RicardoE105! I’m a little confused about the below post from jan tho. Is it okay to write to the .n8n folder? Since I’m running Docker, I thought I should be able to read and write to /files based on what I added to my volumes in docker-compose? (screenshot in original post)

> [@How to Write Binary File on Docker Install?](http://community.n8n.io/t/how-to-write-binary-file-on-docker-install/3538/4):
>
> Welcome to the community @Sasquatch! I do not recommend writing to the .n8n folder! That is where n8n keeps its main data and nobody and nothing else is supposed to write anything in it. For that reason is it also a hidden folder. If you want to write files to disk please check out the documentation:
