STINNER Victor <vstin...@redhat.com> added the comment:

> If I understood PR 10919 correctly, sysconfig.get_config_var('userbase') can 
> now return unexpanded paths containing '~'. Is it intended despite the 
> previous discussion starting with msg135047?

With my PR 10919, "python3 setup.py install" and  "python3 setup.py install 
--user" still fail with:

Traceback (most recent call last):
  File "setup.py", line 79, in <module>
    main()
  File "setup.py", line 75, in main
    setup(**options)
  File "/tmp/cpython/Lib/distutils/core.py", line 121, in setup
    dist.parse_config_files()
  File "/tmp/cpython/Lib/distutils/dist.py", line 397, in parse_config_files
    filenames = self.find_config_files()
  File "/tmp/cpython/Lib/distutils/dist.py", line 349, in find_config_files
    check_environ()
  File "/tmp/cpython/Lib/distutils/util.py", line 161, in check_environ
    os.environ['HOME'] = pwd.getpwuid(os.getuid())[5]
KeyError: 'getpwuid(): uid not found: 12345'

I suggest to open a new issue if you want to enhance the error message and/or 
handle getpwuid() failure in find_config_files().

I prefer to stick to the initial bug report which hasn't been fixed in 8 years:

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

IMHO PR 10919 fix is straighforward, it respects the contract (documentation) 
of posixpath.expanduser() ("If user or $HOME is unknown, do nothing."), and 
expanduser() already handles KeyError on getpwnam() (since the function has 
been created in 1992 by Guido van Rossum! commit 
7ac4878773040158038031a85be122d9e7071afe).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue10496>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to