# Cant read file on same Pi

**URL:** <https://discourse.nodered.org/t/cant-read-file-on-same-pi/74802>\
**Category:** General\
**Created:** [6 February 2023 16:58 UTC](https://discourse.nodered.org/t/cant-read-file-on-same-pi/74802 "2023-02-06T16:58:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tinbum1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tinbum1/32/60100_2.png) [@Tinbum1](https://discourse.nodered.org/u/Tinbum1)\
**Post date:** [6 February 2023 16:58 UTC](https://discourse.nodered.org/t/cant-read-file-on-same-pi/74802/1 "2023-02-06T16:58:16Z")

</div>

I'm using Node-Red on a Raspberry Pi and I'm trying to read a file on the same Pi. I keep getting the error 'Error: ENOENT: no such file or directory, open 'home/pi/test.txt'' but the strange thing is I can write to the file. I'm baffled.

```auto
[{"id":"a939ce7aa81a0053","type":"file in","z":"0871f80587d070df","name":"","filename":"home/pi/test.txt","filenameType":"str","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":1300,"y":1980,"wires":[["c695503e82074b33"]]},{"id":"bbb4d8985f32278b","type":"inject","z":"0871f80587d070df","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1140,"y":1980,"wires":[["a939ce7aa81a0053"]]},{"id":"1ad9744b6062d426","type":"inject","z":"0871f80587d070df","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1140,"y":1920,"wires":[["21e14d3b113d921d"]]},{"id":"21e14d3b113d921d","type":"file","z":"0871f80587d070df","name":"","filename":"home/pi/test.txt","filenameType":"str","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":1300,"y":1920,"wires":[[]]}]

```

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [6 February 2023 17:00 UTC](https://discourse.nodered.org/t/cant-read-file-on-same-pi/74802/2 "2023-02-06T17:00:34Z")

</div>

'home/pi/test.txt''  
Should be '/home/pi/test.txt''.

---

<div class="post-metadata">

**Author:** ![Tinbum1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tinbum1/32/60100_2.png) [@Tinbum1](https://discourse.nodered.org/u/Tinbum1)\
**Post date:** [6 February 2023 17:01 UTC](https://discourse.nodered.org/t/cant-read-file-on-same-pi/74802/3 "2023-02-06T17:01:18Z")

</div>

I tried that first, and // after reading various posts, but still didn't work.

```auto
[{"id":"a939ce7aa81a0053","type":"file in","z":"0871f80587d070df","name":"","filename":"/home/pi/test.txt","filenameType":"str","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":1310,"y":1980,"wires":[["c695503e82074b33"]]}]

```

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [6 February 2023 17:09 UTC](https://discourse.nodered.org/t/cant-read-file-on-same-pi/74802/4 "2023-02-06T17:09:45Z")

</div>

and you are running node-red natively (ie. installed via script and not docker) ?

---

<div class="post-metadata">

**Author:** ![Tinbum1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tinbum1/32/60100_2.png) [@Tinbum1](https://discourse.nodered.org/u/Tinbum1)\
**Post date:** [6 February 2023 17:10 UTC](https://discourse.nodered.org/t/cant-read-file-on-same-pi/74802/5 "2023-02-06T17:10:37Z")

</div>

Yes, it is.

---

<div class="post-metadata">

**Author:** ![Tinbum1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tinbum1/32/60100_2.png) [@Tinbum1](https://discourse.nodered.org/u/Tinbum1)\
**Post date:** [6 February 2023 17:19 UTC](https://discourse.nodered.org/t/cant-read-file-on-same-pi/74802/6 "2023-02-06T17:19:03Z")

</div>

I'm not sure what I've done but it's starting working now. Thanks. All I did was write to the file and then I was able to read it without an error.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 April 2023 17:19 UTC](https://discourse.nodered.org/t/cant-read-file-on-same-pi/74802/7 "2023-04-07T17:19:19Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
