Python crashing when script is running against live system

Dave Angel davea at davea.name
Sun Aug 3 22:17:43 EDT 2014


Igor Korot <ikorot01 at gmail.com> Wrote in message:
> Hi, ALL,
> I'm working on the script that should starting from the given
> directory enumerate all directories and files underneath and
> calculates the hash value of such file.
> It works fine when I start it from some particular directory, but when
> I give the "C:\" it crashes python.

How are you 'giving' that string?  It's not a valid literal. 

How are you running this script?  Are you starting it from a cmd
 prompt (dos box) or some other way? And is that 'other way'
 eating your error information? 

Do you get any messages at all? Nearly every problem that aborts a
 python program will also display some form of error messages to
 stderr.

> 
> The last thing the script processes is the file in cmdcons directory,
> which is AFAIU from the ComboFix run.
> I have Windows XP SP3 with python 2.7.
> 

I haven't needed to use Windows for a long time,  but I seem to
 recall that directory is special to Windows,  containing backup
 copies of certain critical files. So Windows may be protecting it
 from corruption.   What file mode are you using to open those
 files? I would expect 'rb'.


> Now, I'm confused.

So are we, you include no source code, nor do you copy/paste the
 error tracebacks. 

> My questions are:
> 
> 1. Am I able to catch such situation and see where the crash occur?
> 2. If not, what is the proper way to debug such situation?
> 
> I am getting the window saying that python.exe has encountered a
> problem and needs to close.
> 
> The last file processed was "c:\cmdcons\dpti20.sy_".
> 
> What strange about it that when I run the script under debugger (I'm
> using winpdb), it is running further and crashing on some other file.

What's the path to that file? Is it in the same directory?

Are you using stderr for your messages so you'll see them all even
 if the program crashes? 

Does the program run long enough that you can watch memory usage
 with task manager or equivalent? 

Can you run to completion if you skip the part where you open the
 file and calculate the checksums?

How about if you skip that particular directory?  Or if you sort
 the directories in forward or reverse order? If you do change the
 sorts, does it affect where the crash occurs?

This program should be only about 25 lines, so please show it.


-- 
DaveA




More information about the Python-list mailing list