[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-05-09 Thread STINNER Victor
STINNER Victor added the comment: Main changes of the patch, if the current user has no home directory (no entry in /etc/passwd) and there is HOME environment variable: - sysconfig.get_config_vars() doesn't have a 'userbase' variable. sysconfig.get_config_var('userbase') returns None as any

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-05-09 Thread Éric Araujo
Éric Araujo added the comment: In the absence of tests or doc update, can you tell in English what the new behavior is? IIUC, when the home dir is not found, all the variables that depend on it would not exist, right? Or would they be set to None? -- ___

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-05-08 Thread STINNER Victor
STINNER Victor added the comment: @eric.araujo, @tarek: do you prefer nonexistent_user.patch? I removed sysconfig_getuserbase.patch, because I agree that an expanded path containing "~" is a bug. -- ___ Python tracker

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-05-08 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file21640/sysconfig_getuserbase.patch ___ Python tracker ___ ___ Python-bugs-

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-05-05 Thread STINNER Victor
STINNER Victor added the comment: > If the user base cannot be calculated, paths > starting with ~ should not exist or be used at all in this context. It's not "~" but "{userbase}" substitution variable. Here is a new patch implementing this idea: don't create the variables using the user dir

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-05-03 Thread Tarek Ziadé
Tarek Ziadé added the comment: Paths that are starting with ~ should be extended with the right value with the user base. If the user base cannot be calculated, paths starting with ~ should not exist or be used at all in this context. Maybe we need to completely reset them to None like userba

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-05-03 Thread Éric Araujo
Éric Araujo added the comment: This is the one thing about which I wanted a call: “after the patch, paths returned by sysconfig may not be fully expanded paths” (i.e. they may start with '~'). -- ___ Python tracker

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-05-02 Thread Tarek Ziadé
Tarek Ziadé added the comment: As discussed w/ Victor, a process should be able to run Python even if its user does not have a home. So the call to _getuserbase() should be protected. But then we have to control that all the code that uses CONFIG_VARS['userbase'] is protected when the valu

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-05-02 Thread STINNER Victor
STINNER Victor added the comment: > I would like Tarek to make a call on this. So Tarek, what do you think? -- ___ Python tracker ___ __

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-04-15 Thread Éric Araujo
Éric Araujo added the comment: It’s not just a try/except, it’s a behavior change: after the patch, paths returned by sysconfig may not be fully expanded paths. I would like Tarek to make a call on this. -- assignee: -> tarek ___ Python tracker

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-04-14 Thread STINNER Victor
STINNER Victor added the comment: Because the patch is simple (just add a try/except), I think that it doesn't matter if only few people use users without entry in /etc/passwd and we should fix this issue. -- ___ Python tracker

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-04-14 Thread Charles-Francois Natali
Charles-Francois Natali added the comment: I'm not sure whether POSIX warrants anything about this behavior, but nothing prevents a process from running with a UID not listed in /etc/passwd (or NIS, whatever). For example, sudo allows running a command with a UID not listed in the password da

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-04-13 Thread Éric Araujo
Éric Araujo added the comment: Can you be more precise? IOW, why is this a Python bug rather than a system misconfiguration? Note that I don’t know a lot about POSIX, so I’m open to change my mind. -- stage: needs patch -> versions: +Python 3.3

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-04-13 Thread Brian Bi
Brian Bi added the comment: I discovered this while I was implementing and testing a sandbox for automatic evaluation of programs. -- ___ Python tracker ___ ___

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-04-13 Thread Éric Araujo
Éric Araujo added the comment: Can someone explain how it can happen that a user has no home directory? -- ___ Python tracker ___ ___

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-04-12 Thread STINNER Victor
Changes by STINNER Victor : Added file: http://bugs.python.org/file21640/sysconfig_getuserbase.patch ___ Python tracker ___ ___ Python-bugs-li

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-04-12 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file21639/sysconfig_getuserbase.patch ___ Python tracker ___ ___ Python-bugs-

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-04-12 Thread STINNER Victor
Changes by STINNER Victor : -- keywords: +patch Added file: http://bugs.python.org/file21639/sysconfig_getuserbase.patch ___ Python tracker ___ __

[issue10496] "import site failed" when Python can't find home directory (sysconfig._getuserbase)

2011-04-12 Thread STINNER Victor
STINNER Victor added the comment: This issue remembers me the issue #6612 (failure if the current directory was removed): the fix was to ignore os.getcwd(). Attached patch ignores os.path.expanduser() error (KeyError) and keeps ~ in the path. Example without HOME var and with an non existent

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

2011-04-03 Thread Éric Araujo
Changes by Éric Araujo : -- nosy: +eric.araujo, haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://ma

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

2011-04-01 Thread Denis Barmenkov
Denis Barmenkov added the comment: I saw similar error on Python 2.6 installed on freeBSD. I had test SVN server and wrote pre-commit hook using python. When remote developer commited his changes to repository, hook called os.path.expanduser and exception was raised: # File "/usr/loca

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

2010-11-28 Thread Xuanji Li
Xuanji Li added the comment: I tried running bug.c using the svn head of python and got this: Could not find platform independent libraries Could not find platform dependent libraries Consider setting $PYTHONHOME to [:] Fatal Python error: Py_Initialize: Unable to get the locale encoding Look

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

2010-11-24 Thread Ned Deily
Changes by Ned Deily : -- versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.6 ___ Python tracker ___ ___ Python-bugs-list mailin

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

2010-11-24 Thread Ned Deily
Ned Deily added the comment: The problem is reproducible on a current Debian Linux system although with different results for current versions of Python (only security issues are accepted against 2.6). Unlike with 2.6, 3.1 reports no error. 2.7 and 3.2 both fail with an exception: Tracebac

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

2010-11-24 Thread Ned Deily
Changes by Ned Deily : -- Removed message: http://bugs.python.org/msg122051 ___ Python tracker ___ ___ Python-bugs-list mailing list U

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

2010-11-21 Thread Brian Bi
Brian Bi added the comment: 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

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

2010-11-21 Thread Brian Bi
New submission from Brian Bi : 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 U