short story I accidentally wrote rm *.py into my makefile (yes, I amIf your code doesn't use too much features post-2.3, you could try
old-fashioned, and yes, that was very, veeeery stupid) and - bad things
never come alone - my remote backup files are corrupted. To cut a sad
story short: I just kind of lost four months work on my bachelor's
thesis, well almost. I still have the pyc files (and backuped them on
virtually every device I have access to now), but despite intense
googling I couldn't find any free way of decompiling 2.5-code -- there
is depython.net and the online version of decompyle, but they charge
money (which I currently don't have), and the free version of decompyle
can't handle marshal data 2.3, and I lack the skills necessary to
extend it to 2.5.
Does anybody know something I don't, some home-brewn decompiler,
anything? I *am* quite desperate...
regenerating the .pyc files using the old marshal format and feed the
resulting .pyc to decompyle - if you're lucky it may accept it...
--- begin ---
import marshal
MAGIC23 = ';\xf2\r\n'
def load_pyc(filename):
f = open(filename, 'rb')
try:
magic = f.read(4)
timestamp = f.read(4)
codeobject = marshal.load(f)
finally:
f.close()
return magic, timestamp, codeobject
def dump_pyc_23(filename, timestamp, codeobject):
assert len(timestamp)==4
f = open(filename, 'wb')
try:
f.write(MAGIC23)
f.write(timestamp)
marshal.dump(codeobject, f, 0)
finally:
f.close()
magic, timestamp, codeobject = load_pyc("test25.pyc")
dump_pyc_23("test23.pyc", timestamp, codeobject)
--- end ---
Good luck!
--
Gabriel Genellina