This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Ugly traceback for DistutilsPlatformError
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: akuchling Nosy List: akuchling, gward
Priority: normal Keywords:

Created on 2001-02-20 16:23 by gward, last changed 2022-04-10 16:03 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
distutils.platform akuchling, 2002-11-04 13:54 Catch DistutilsPlatformError
Messages (5)
msg3513 - (view) Author: Greg Ward (gward) (Python committer) Date: 2001-02-20 16:23
From Chad Lester:

> I was setting up a new redhat machine, and had forgotten to install the
> python-devel rpm.  The distutils provide a fairly ugly stack trace / error
> message.  Luckily, it meant something to me... but it's not terribly user
> friendly!
>    
> ...
>   File "/usr/lib/python1.5/site-packages/distutils/sysconfig.py", line
> 368, in get_config_vars
>     func()
>   File "/usr/lib/python1.5/site-packages/distutils/sysconfig.py", line
> 280, in _init_posix
>     raise DistutilsPlatformError, my_msg
> distutils.errors.DistutilsPlatformError: invalid Python
> installation: unable to open /usr/lib/python1.5/config/Makefile (No such
> file or directory)
> 
> 

msg3514 - (view) Author: Greg Ward (gward) (Python committer) Date: 2001-02-20 16:24
This only applies for people installing Distutils
under Python 1.5.2, so it will only be fixed if
there is another Distutils release to support 1.5.2 --
which is unlikely.
msg3515 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2001-12-06 16:18
Logged In: YES 
user_id=11375

Greg, I don't understand your last comment on this bug.  
Surely the traceback will still be ugly for people running
Python 2.2 or whatever who don't have the python-devel RPM
installed?  I don't see how this is only a 1.5.2 or a
"installing Distutils" question. 
msg3516 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2002-11-04 13:54
Logged In: YES 
user_id=11375

A simple fix is in the attached patch; it simply adds DistutilsPlatformError to the list of the exception classes caught 
by core.setup().  

However, maybe that exception handler should 
catch DistutilsError, instead of listing a few particular subclasses of it.  Some subclasses represent internal errors or a bad setup file, but 
as users can always get the full traceback by setting the DISTUTILS_DEBUG environment variable, there seems little need to 
ever show the full traceback by default.
msg3517 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2002-11-08 16:19
Logged In: YES 
user_id=11375

I've checked in my proposed fix (the more liberal version that catches
all DistutilsError exceptions) as revision 1.54 of distutils/core.py.
History
Date User Action Args
2022-04-10 16:03:46adminsetgithub: 33974
2001-02-20 16:23:09gwardcreate