Issue Running a Python Script from Execute Command Node on DigitalOcean

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.

I added Python to my server using this article for the steps 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


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

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

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…

And the error I am getting…

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

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.

1 Like

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.

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?

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.

1 Like

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)