Loaded python library and python executable may come from different sources
Admittedly, I am not testing this on the master branch, but I think the bug still holds.
The code uses g_module_open
to open the dynamically loaded python library (which is defined at compile time).
https://gitlab.gnome.org/GNOME/nautilus-python/-/blob/master/src/nautilus-python.c#L158
However I do not think that the Py*
functions called are using the dynamically loaded library.
https://gitlab.gnome.org/GNOME/nautilus-python/-/blob/master/src/nautilus-python.c#L178
I say this because I:
- Kill all active nautilus instances:
killall -s 9 nautilus
- Activated some conda environment.
- Opened the
.so
file from the libnautilus-python extension, and edited that first call to python code to be more likeimport sys; print(sys.executable) # the rest of the code
instead ofimport sys; sys.path = [path for path in sys.path if path]
- Started nautilus from within the activated conda environment.
- Noticed that it printed the conda executable for python.
I get it. I shouldn't be running (starting) nautilus from within a conda environment. But it just seemed strange to me that the library was loaded from a hardcoded location at compile time, but the python executable was used from the active path.
I'm not an expert with the Python C API or the GObject API.