Anton Smerdov
Anton Smerdov

Reputation: 41

How to read corrupted .py file

My .py file is corrupted in case of BSOD. If I open it in PyCharm it looks like empty file. If I open it in IPython it looks like this

UPD. Hexdump(My OS is Windows, but I did it in Linux) enter image description here

UPD2. Everything is OK, I have dowloaded my file from Google Drive. Strangely, but earlier it suggests only last week file. Thanks all again.

Upvotes: 4

Views: 4318

Answers (1)

cdarke
cdarke

Reputation: 44354

You can write a quick n' dirty hex dump utility in python, since you are on Windows:

with open('gash.py', 'rb') as f:
    for line in f:
        line_list = []
        for char in line:
            line_list.append("%02X" % (char))
        print(' '.join(line_list))

Where gash.py is the name of your python script.

That at least will tell you if there is anything that can be retrieved (but I doubt it).

Upvotes: 1

Related Questions