28.6. Where is SCons Blowing Up? the `--debug=stacktrace` Option
Prev | Chapter 28. Troubleshooting | Next

## 28.6. Where is SCons Blowing Up? the `--debug=stacktrace` Option

In general, SCons tries to keep its error messages short and informative. That means we usually try to avoid showing the stack traces that are familiar to experienced Python programmers, since they usually contain much more information than is useful to most people.

For example, the following `SConstruct` file:

    Program('prog.c')

Generates the following error if the `prog.c` file does not exist:

    % scons -Q
    scons: *** [prog.o] Source `prog.c' not found, needed by target `prog.o'.

In this case, the error is pretty obvious. But if it weren't, and you wanted to try to get more information about the error, the `--debug=stacktrace` option would show you exactly where in the SCons source code the problem occurs:

    % scons -Q --debug=stacktrace
    scons: *** [prog.o] Source `prog.c' not found, needed by target `prog.o'.
    scons: internal stack trace:
      File "SCons/Taskmaster/Job.py", line 670, in _work
        task.prepare()
      File "SCons/Script/Main.py", line 209, in prepare
        return SCons.Taskmaster.OutOfDateTask.prepare(self)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "SCons/Taskmaster/__init__.py", line 195, in prepare
        executor.prepare()
      File "SCons/Executor.py", line 424, in prepare
        raise SCons.Errors.StopError(msg % (s, self.batches[0].targets[0]))

Of course, if you do need to dive into the SCons source code, we'd like to know if, or how, the error messages or troubleshooting options could have been improved to avoid that. Not everyone has the necessary time or Python skill to dive into the source code, and we'd like to improve SCons for those people as well...

Prev | Up | Next
28.5. Where is SCons Searching for Libraries? the `--debug=findlibs` Option | Home | 28.7. How is SCons Making Its Decisions? the `--taskmastertrace` Option