[Distutils] Exceptions

Thomas Heller theller at python.net
Tue Jun 24 20:29:13 EDT 2003


distutils/core.py contains this code, in the setup() function:

    # And finally, run all the commands found on the command line.
    if ok:
        try:
            dist.run_commands()
        except KeyboardInterrupt:
            raise SystemExit, "interrupted"
        except (IOError, os.error), exc:
            error = grok_environment_error(exc)

            if DEBUG:
                sys.stderr.write(error + "\n")
                raise
            else:
                raise SystemExit, error

        except (DistutilsError,
                CCompilerError), msg:
            if DEBUG:
                raise
            else:
                raise SystemExit, "error: " + str(msg)

In my case, I have a custom "test" command in my setup script, which
imports test scripts from a unittests directory. As it goes, the
importing of one of the script fails with an OSError. This is my fault,
of course, but it seems distutils tries all to hide the error from the
user.

On Windows, the output of the setup script is:
  running test
  running build
  running build_py
  running build_ext
  error: Das angegebene Modul wurde nicht gefunden

and on Linux, even worse:
  running test
  running build
  running build_py
  running build_ext
  error: None

I've tried to find out what's wrong, and eventually found the
DISTUTILS_DEBUG environment variable. When this is set, the full
traceback is printed (among a lot of other output).

IMO this behaviour is not helpful, and the DISTUTILS_DEBUG variable is
undocumented.

In which way should this be changed?

Thomas




More information about the Distutils-SIG mailing list