# Run python file on startup

**URL:** <https://rpi-rgb-led-matrix.discourse.group/t/run-python-file-on-startup/1118>\
**Category:** Uncategorized\
**Created:** [September 9, 2025, 8:47am UTC](https://rpi-rgb-led-matrix.discourse.group/t/run-python-file-on-startup/1118 "2025-09-09T08:47:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yvonne](https://avatars.discourse-cdn.com/v4/letter/y/3be4f8/32.png) [@Yvonne](https://rpi-rgb-led-matrix.discourse.group/u/Yvonne)\
**Post date:** [September 9, 2025, 8:47am UTC](https://rpi-rgb-led-matrix.discourse.group/t/run-python-file-on-startup/1118/1 "2025-09-09T08:47:51Z")

</div>

Hello,

I have a rpi-rgb- led matrix 16 rows and 32 cols.

I wrote a Python file in order to run my own text which changes every minute.

I wrote the following code in rc.local:

#!/bin/shpio -e

\_IP=$(hostname -I) || true  
if [“$\_IP”]; then  
printf “My IP address is %s\n” “$\_IP”  
fi

python3 /home/lo/rpi-rgb-led-matrix/bindings/python/samples/rungoed.py -m=adafruit-hat --led-rows=16 --led-cols=32 --led-slowdown-gpio=0 &  
exit 0

The program is not running at startup.

I changed the code to:  
#!/bin/shpio -e

\_IP=$(hostname -I) || true  
if [“$\_IP”]; then  
printf “My IP address is %s\n” “$\_IP”  
fi

cd /home/lo/rpi-rgb-led-matrix/bindings/python/samples &  
python3 rungoed.py -m=adafruit-hat --led-rows=16 --led-cols=32 --led-slowdown-gpio=0 &

exit 0

The code doesn’t work either.

If I use  
python3 /home/lo/rpi-rgb-led-matrix/bindings/python/samples/rungoed.py -m=adafruit-hat --led-rows=16 --led-cols=32 --led-slowdown-gpio=0

on the command prompt it works perfect.

I hope you can give me advice what I have to change.

Thank you.

Lo

---

<div class="post-metadata">

**Author:** ![marcmerlin](https://yyz2.discourse-cdn.com/free1/user_avatar/rpi-rgb-led-matrix.discourse.group/marcmerlin/32/40_2.png) [@marcmerlin](https://rpi-rgb-led-matrix.discourse.group/u/marcmerlin)\
**Post date:** [September 16, 2025, 11:59pm UTC](https://rpi-rgb-led-matrix.discourse.group/t/run-python-file-on-startup/1118/2 "2025-09-16T23:59:02Z")

</div>

does rc.local actually run?

Have you looked at your rpi distro documentation on how to enable it and whether it’s enabled (google systemd rc.local)

---

<div class="post-metadata">

**Author:** ![board707](https://avatars.discourse-cdn.com/v4/letter/b/bc79bd/32.png) [@board707](https://rpi-rgb-led-matrix.discourse.group/u/board707)\
**Post date:** [September 17, 2025, 7:26am UTC](https://rpi-rgb-led-matrix.discourse.group/t/run-python-file-on-startup/1118/3 "2025-09-17T07:26:59Z")

</div>

> [@Yvonne](#):
>
> python3 /home/lo/rpi-rgb-led-matrix/bindings/python/samples/rungoed.py -m=adafruit-hat --led-rows=16 --led-cols=32 --led-slowdown-gpio=0 &

May be you have to call python3 with a full path.

---

<div class="post-metadata">

**Author:** ![Yvonne](https://avatars.discourse-cdn.com/v4/letter/y/3be4f8/32.png) [@Yvonne](https://rpi-rgb-led-matrix.discourse.group/u/Yvonne)\
**Post date:** [September 17, 2025, 2:46pm UTC](https://rpi-rgb-led-matrix.discourse.group/t/run-python-file-on-startup/1118/4 "2025-09-17T14:46:33Z")

</div>

Thank you so much for your advice.

I read [https://www.cyberciti.biz/faq/how-to-enable-rc-local-shell-script-on-systemd-while-booting-linux-system/](https://www.cyberciti.biz/faq/how-to-enable-rc-local-shell-script-on-systemd-while-booting-linux-system/) and followed the instructions.

Now my programs starts when starting the Raspberry Pi.

I’m happy.  
Thank you.

Yvonne

---

<div class="post-metadata">

**Author:** ![Yvonne](https://avatars.discourse-cdn.com/v4/letter/y/3be4f8/32.png) [@Yvonne](https://rpi-rgb-led-matrix.discourse.group/u/Yvonne)\
**Post date:** [September 17, 2025, 2:47pm UTC](https://rpi-rgb-led-matrix.discourse.group/t/run-python-file-on-startup/1118/5 "2025-09-17T14:47:46Z")

</div>

Thank you for your help. As you can see I succeeded.
