Hi!
I am trying to write information into a simple textfile, using the write file node. Neither if I input the path/filename with "msg.filename" (msg.filename = /home/pi/Projekte/Files/Test.txt) nor if I insert the absolute path/filename (within the node) using "Path", I am able to generate the file.
I always get:
"failed to create file: Error: EACCES: permission denied, mkdir '/home/pi/Projekte/Files' "
Consequently also reading this file fails.
Node-RED is running on a PI. The textfile should reside on the same PI.
I checked the permissions down from /home to /home/pi/Projekte/Files. All directorys are RWX-enabled for user, group and others.
Addressing as follows (not absolute but relativ) works ...
msg.filename = ./home/pi/Projekte/Files/Test.txt
... but this generates a new directory somewhere as sub-directory of the working directory of the Node-RED-process which is unfortunately changing every time I restart the PI.
Seems all so easy, but I don't get it running.
Peter
pi@raspberrypi:~ $ ls -al /home/pi/Projekte
insgesamt 24
drwxrwxrwx 4 pi pi 4096 22. Feb 18:15 .
drwxrwxrwx 17 pi pi 4096 9. Mär 10:54 ..
-rw-r--r-- 1 pi pi 290 22. Feb 18:15 File.csv
drwxrwxrwx 2 pi pi 4096 21. Feb 11:01 Files
drwx------ 2 pi pi 4096 18. Nov 08:15 TrainControl
-rw-r--r-- 1 pi pi 1831 8. Dez 19:28 TrainControl.geany
And for dynamicdave:
I want to use the path/filename absolutely (without the dot). But that is exactly what does not work.
Using the dot works, but generates a directory anywhere deep inside the system (on changing positions).
I installed Node-RED via docker. But I must admit I did it, following a detailed description without really knowing what I was doing. In the end it worked. And it still works perfectly. It is just this little annoying detail so far.
With ./home/pi/ .... I find my file under:
/proc/1940/task/1940/cwd/home/pi/Projekte/Files/
And for the start: Sorry, but I am not an expert. I suppose, Node-RED is somehow started by being an entry of an autostart file, after powered on.
The file node writes to the "Machine" it is running in. Since docker is (for ease of discussion) a virtual machine, files will be saved inside of the docker VM unless you map directories from the HOST to the container.
If you dont want these subtle complexities or dont have/want to spend the time learning how docker virtualises things, you might be better off with a traditional installation (that's what most of us here do).
Since your file name mentions pi I suspect you are running docker on a Raspberry PI? The traditional installation of Node-RED on a PI couldn't be simpler - just run the official installer script. Then when you ask for a file to be written to /home/pi/Projekte/...whatever it will go to the filesystem on the PI, not some internal virtualised filesystem inside a docker container.