[Bug 197219] Re: /usr/local/lib/python/sitecustomize.py broken due to overriding sitecustomize in /etc

Thomas Güttler guettliml.launchpad at thomas-guettler.de
Mon Sep 24 10:54:41 UTC 2018


Ubuntu 18.04 does come with a sitecustomize.py file.

I think this is not a good solution.

I would really like to be able to execute some python code during
interpreter start.

AFAIK sitecustomize.py is the way to got. But if ubuntu provides one,
then this does not work.

Related question: https://stackoverflow.com/questions/52449602/how-to-
set-environment-variables-in-virtualenv-started-via-python


root at 1b3dffd4d058:/# python
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34) 
>>> import sitecustomize
>>> sitecustomize.__file__
'/usr/lib/python2.7/sitecustomize.pyc'

root at 1b3dffd4d058:/# cat /etc/os-release 
NAME="Ubuntu"
VERSION="18.04 LTS (Bionic Beaver)"

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to diveintopython in Ubuntu.
https://bugs.launchpad.net/bugs/197219

Title:
  /usr/local/lib/python/sitecustomize.py broken due to overriding
  sitecustomize in /etc

Status in diveintopython package in Ubuntu:
  Triaged
Status in python2.5 package in Ubuntu:
  Won't Fix
Status in python2.6 package in Ubuntu:
  Won't Fix

Bug description:
  sitecustomize.py files have been added to /etc/python2.5/ nad
  /usr/lib/python2.5/ in hardy, which breaks the use of /usr/local/lib
  /site-python/sitecustomize.py, silently causing it to not be imported.

  My impression has always been that sitecustomize.py is to be reserved
  for the user (i.e., it's the python equivilent of debian's
  /usr/local/, thou shalt not touch it).

  site.py already allows for distribution specific additions; if they
  are to be placed outside site.py, then they should be placed in a
  third file such that the import of sitecustomize.py still proceeds as
  expected by the user.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/diveintopython/+bug/197219/+subscriptions



More information about the foundations-bugs mailing list