nZac

Just Read the Code

I was debugging something really annoying: a system library wouldn’t load in a Django project. All the online sources said to set MY_LIBRARY_PATH with the path to the dylib.

But the code wasn’t looking in the environment—it was checking the Django settings for MY_LIBRARY_PATH. I only realized this after an hour of futzing around and questioning everything I know about shared libraries. Eventually, I opened the code where the load actually happens and saw it used getattr(settings, "MY_LIBRARY_PATH") instead of os.environ.get.

Lesson learned: just read the code.

#lessons