gagsl-py2 at yahoo.com.ar
Tue Sep 16 00:56:51 EDT 2008
En Mon, 15 Sep 2008 20:57:24 -0300, Manuel Ebert <maebert at uos.de> escribió:
> short story I accidentally wrote rm *.py into my makefile (yes, I am
> 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...
If your code doesn't use too much features post-2.3, you could try
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 ---
MAGIC23 = ';\xf2\r\n'
f = open(filename, 'rb')
magic = f.read(4)
timestamp = f.read(4)
codeobject = marshal.load(f)
return magic, timestamp, codeobject
def dump_pyc_23(filename, timestamp, codeobject):
f = open(filename, 'wb')
marshal.dump(codeobject, f, 0)
magic, timestamp, codeobject = load_pyc("test25.pyc")
dump_pyc_23("test23.pyc", timestamp, codeobject)
--- end ---
More information about the Python-list