Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to decompile any .pyc file #23

Closed
SharmaVimarsh opened this issue Feb 19, 2013 · 9 comments
Closed

Unable to decompile any .pyc file #23

SharmaVimarsh opened this issue Feb 19, 2013 · 9 comments

Comments

@SharmaVimarsh
Copy link

Hi,

I am using Uncompyle2 for my own purpose and trying to decompile .pyc file to py with 2.7 Python Shell for this.

Below is the message I am getting :

uncompyle2.uncompyle_file("\Queue.pyc",None,0,0)

Traceback (most recent call last):
File "<pyshell#11>", line 1, in
uncompyle2.uncompyle_file("\Queue.pyc",None,0,0)
File "C:\uncompyle2\uncompyle2__init__.py", line 140, in uncompyle_file
version, co = load_module(filename)
File "C:\uncompyle2\uncompyle2__init
_.py", line 74, in _load_module
raise ImportError, "Unknown magic number %s in %s" % (ord(magic[0])+256*ord(magic[1]), filename)
ImportError: Unknown magic number 62215 in \Queue.pyc

Thanks,
Vimarsh

@wibiti
Copy link
Owner

wibiti commented Feb 19, 2013

Hi,
That magic number is "newer" than the the most recent python 2.7.3 release.
Maybe it's from a pre-release version of 2.7.4. Or it could be from a custom python version.
You could try adding 62215 to the magic numbers in magics.py.

@SharmaVimarsh
Copy link
Author

Hi,

After adding the magic number in magics.py file, now its giving me "ValueError: bad marshal data (unknown type code)"

Is this error specific to uncompyle2 or python?

For different files there are different errors, can you please give me any specific file that can be compiled back to .py

Thanks,
Vimarsh

@wibiti
Copy link
Owner

wibiti commented Feb 21, 2013

That error comes from the marshal module which is a standard python module. The marshal module is used by python to serialize python objects, particularly code objects. Uncompyle2 uses the marshal module to unserialize the code in a pyc file into a live python code object. Usually the marshal format doesn't change much between versions of python, but that error indicates that the version of python which generated your .pyc files has changed the marshal format enough to no longer be compatible with the version of python which is executing uncompyle2.

You can see the marshal type codes of the latest python 2.7 release here: http://svn.python.org/projects/python/branches/release27-maint/Python/marshal.c

@SharmaVimarsh
Copy link
Author

Hi wibiti,

Thanks for the information you are providing, according to your last reply does it mean files I am trying are not compatible with uncompyle2.

And does 2.7 means 2.7.x (x = 3 or any version number) compiled file will not work with 2.7 uncompyle2?

Thanks,
Vimarsh

@wibiti
Copy link
Owner

wibiti commented Feb 21, 2013

uncompyle2 should work with 2.7.1 through 2.7.3. I'm not sure about 2.7.0
or prerelease versions of 2.7. There are still bugs, but it will decompile
the majority of such files, and I try to fix bugs that are reported.

I'm not sure what version of python generated your .pyc files, but from the
magic number error we know it's not from any released version of python 2.7

There is a chance that if you have the version of python that compiled
those files and used that version of python to run uncompyle2 then it might
work. At least you wouldn't get the marshal error, but most likely you'd
get some other error. You could implement your own marshal. Uncompyle2
used to use it's own marshal implementation before switching to using the
standard python marshal.
https://github.com/wibiti/uncompyle2/blob/428ab87733fe00789ac9a861c1ae686d5bf3e731/uncompyle2/marshal.py

On Thu, Feb 21, 2013 at 7:10 AM, Vimarsh N Sharma
notifications@github.comwrote:

Hi wibiti,

Thanks for the information you are providing, according to your last reply
does it mean files I am trying are not compatible with uncompyle2.

And does 2.7 means 2.7.x (x = 3 or any version number) compiled file will
not work with 2.7 uncompyle2?


Reply to this email directly or view it on GitHubhttps://github.com//issues/23#issuecomment-13887814.

@SharmaVimarsh
Copy link
Author

Hi wibiti,

I want to get some files decompiled, if you feel fine can you please send me your details to my email address sharmavimarsh@gmail.com so I can send you files as files are important for me.

Thanks,
Vimarsh

@wibiti
Copy link
Owner

wibiti commented Feb 25, 2013

Hi Vimarsh,

I don't have a lot of time available for this kind of work. I'm sorry uncompyle2 isn't able to decompile your files.
There is another branch of uncompyle2 here: https://github.com/Mysterie/uncompyle2. You could try asking for help there. Sorry.

@SharmaVimarsh
Copy link
Author

Hi wibiti,

Thanks for co-operation, I will go through the link you have suggested and meanwhile I will ask if I came through any error or help.

Thanks,
Vimarsh

@wibiti wibiti closed this as completed Mar 6, 2013
@venkateshprabu
Copy link

I am also facing the same issue. After adding the magic number (62215) I am getting this error, ValueError: bad marshal data (unknown type code). I also tried this one https://github.com/Mysterie/uncompyle2 but still same issues.

Vimarsh,

Can you able to decompile after that ?

I would appreciate if someone can guide me to retrieve files from that. Please let me know if you need any sample file having the problem.

Thanks,
Venkatesh

glensc added a commit to pld-linux/uncompyle2 that referenced this issue Sep 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants