# Python os.path.exists() broken after RGBMatrix initialization

**URL:** <https://rpi-rgb-led-matrix.discourse.group/t/python-os-path-exists-broken-after-rgbmatrix-initialization/1213>\
**Category:** Uncategorized\
**Created:** [April 7, 2026, 6:22pm UTC](https://rpi-rgb-led-matrix.discourse.group/t/python-os-path-exists-broken-after-rgbmatrix-initialization/1213 "2026-04-07T18:22:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dereksp](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@dereksp](https://rpi-rgb-led-matrix.discourse.group/u/dereksp)\
**Post date:** [April 7, 2026, 6:22pm UTC](https://rpi-rgb-led-matrix.discourse.group/t/python-os-path-exists-broken-after-rgbmatrix-initialization/1213/1 "2026-04-07T18:22:09Z")

</div>

Under the current build, I am having issues with os.path.exists() behaving differently after the call to RGBMatrix(). I thought it might be similar to [Cpython bug?! include path break after rgbmatrix()](https://rpi-rgb-led-matrix.discourse.group/t/cpython-bug-include-path-break-after-rgbmatrix/1053) because I am using a vent due to running on RaspberryPi under Trixie (you can’t really use pip anymore, has to comp from apt install python3-xxxx.) I tried using the system.path.append() hack from that post to no avail. This is the bit of code that breaks:

* * *

import sys  
sys.path.append(“venv/lib/python3.13/site-packages/”)  
import os  
from rgbmatrix import RGBMatrix, RGBMatrixOptions  
myPath = os.path.abspath(sys.argv[0])

print("Before RGBMatrix: " + sys.argv[0] + " os.path.exists is " + str(os.path.exists(sys.argv[0])))  
print("Before RGBMatrix: " + myPath + " os.path.exists is " + str(os.path.exists(myPath)))

matrix = RGBMatrix()

print("After RGBMatrix: " + sys.argv[0] + " os.path.exists is " + str(os.path.exists(sys.argv[0])))  
print("After RGBMatrix: " + myPath + " os.path.exists is " + str(os.path.exists(myPath)))

* * *

path is true on the relative path both times, but False on the absolute path after the call to RGBMatrix(). For example, this prints (dots are me carving off the long path):

* * *

Before RGBMatrix: testpath.py os.path.exists is True  
Before RGBMatrix: /home/……./testpath.py os.path.exists is True  
Suggestion: to slightly improve display update, add  
isolcpus=3  
at the end of /boot/cmdline.txt and reboot (see README.md)  
After RGBMatrix: testpath.py os.path.exists is True  
After RGBMatrix: /home/……./testpath.py os.path.exists is False

* * *

This is under Raspbian based on Debian Trixie on a Pi running Python 3.13 using a default venv. Only thing special in the venv is the rgb\_led library I built while that vent was active. It is run as such:

sudo vent/bin/python testpath.py

-or–

sudo python testpath.py

Any thoughts? I am sure the vent has something to do with it. Maybe I need to build the lib using the venv. I did not test a relative path with slashes, not sure if that is related.
