GNU bug report logs -
#50105
[core-updates] Python sitecustomize issue.
Previous Next
Reported by: Mathieu Othacehe <othacehe <at> gnu.org>
Date: Wed, 18 Aug 2021 09:54:02 UTC
Severity: important
Tags: patch
Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 50105 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Mathieu,
[...]
> I think the issue here lies in the sitecustomize.py file introduced with
> cb72f9a773e0931ee3758c851d96007ded034e4c.
>
> python_root = os.path.realpath(sys.executable).split('/bin/')[0]
>
>
> When using the Python C library, sys.executable is not the expected
> python binary but the test binary.
>
> So when we try to find the associated libraries in the Python search
> path, this way:
>
> index = sys_path_absolute.index(python_site)
> sys.path = sys.path[:index] + matching_sites + sys.path[index:]
>
>
> we get:
>
> ValueError: '/home/mathieu/glade-3.38.2/build/lib/python3.9/site-packages' is not in list
>
>
> Running the test with the PYTHONPATH set to:
>
> PYTHONPATH=/home/mathieu/glade-3.38.2/build/lib/python3.9/site-packages:$PYTHONPATH
>
> is a way to work around this issue.
>
> The fix here would be to replace sys.executable in the sitecustomize.py
> with something more adequate, but I have no idea what could it be.
From the doc [0], sys.prefix seems to be more correct. This had been
suggested by Hartmut some time ago and I had this patch ready recently.
Perhaps it already addresses the issue at hand?
You'll find it attached. It hasn't gotten much testing yet.
[0] https://docs.python.org/3/library/sys.html#sys.prefix
[0001-aux-files-sitecustomize-Cleanup-and-add-explanatory-.patch (text/x-patch, attachment)]
This bug report was last modified 3 years and 229 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.