Core Dump - Segmentation Fault -Newbie

Doug Morse morse at edoug.org
Fri Jul 18 16:07:45 CEST 2008


On Fri, 18 Jul 2008 15:56:10 +0200, Stefan Behnel <stefan_ml at behnel.de> wrote:
>  johnericaturnbull at yahoo.com wrote:
> > Hi - I am very new to python. I get this random core dump and am
> > looking for a good way to catch the error. I know the function my core
> > dump occurs. Is there any error catching/handling that I could use in
> > python?
> 
>  Since you are using Windows, this is somewhat non-trivial due to the lack of
>  tools shipped by Microsoft. Are you really getting crashes of the interpreter
>  and not just an exception with a stacktrace?
> 
>  Stefan

Hi John,

Well, I must be missing something re: why Stefan states that you are using
Windows.  I don't see that stated in your original post, and, AFAIK, the
phrase "core dump" is seen much more in the Unix world than in the Windows
world.

So, just in case you are on some *nix variant, you can of course log all the
system calls up until your core dump by running:

$ strace -o logfile.txt python [...]

where [...] should be replaced with any parameters to the python interpreter,
such as the Python script you're running, e.g., 

$ strace -o logfile.txt python Hello.py

The trace of system calls will be in the file logfile.txt.  For more info on
strace, see the strace(1) man page (i.e., run "man strace").

Doug




More information about the Python-list mailing list