[issue10496] "import site failed" when Python can't find home directory

Brian Bi report at bugs.python.org
Mon Nov 22 01:59:52 CET 2010

New submission from Brian Bi <bbi5291 at gmail.com>:

This bug is Linux-specific.

When Python cannot find the home directory of the user invoking it, it prints "'import site' failed; use -v for traceback".

This occurs only when both of these conditions are met:
1. /etc/passwd contains no entry for the current real UID
2. the HOME environment variable does not exist

To duplicate this bug, compile and run the attached program as root.
(Note that this will fail if 12345 is a legitimate user on your system, or if Python is not at /usr/bin/python.)

components: None
files: bug.c
messages: 122051
nosy: bbi5291
priority: normal
severity: normal
status: open
title: "import site failed" when Python can't find home directory
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file19760/bug.c

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list