OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Python Debugged EXE Output to PYC <class 'ValueError'>; bad marshal data (unknown type code) Error

  • Thread starter Thread starter dean0x45
  • Start date Start date
D

dean0x45

Guest
I am trying to completely de-compile an EXE file I made using Pyinstaller. I am using a tool called pyinstxtractor AKA PyInstallerExtractor to debug the EXE. I am trying to convert the output of the debugger to a PYC file, but when I prepend the magic numbers from a current PYC file within the output of the debugger to the output I am converting to a PYC file I think the file gets corrupt, like I am doing it wrong. The reason I think this is because I am using uncompyle6 to convert the PYC file back to Python code I get this error:

Code:
# path . must point to a Python source that can be compiled, or Python bytecode (.pyc, .pyo)

File '-o' doesn't exist. Skipped
Traceback (most recent call last):
  File "C:\Users\deanm\anaconda3\lib\site-packages\xdis-5.0.7-py3.8.egg\xdis\load.py", line 293, in load_module_from_file_object
    co = marshal.loads(bytecode)
ValueError: bad marshal data (unknown type code)
Traceback (most recent call last):
  File "C:\Users\deanm\anaconda3\lib\site-packages\xdis-5.0.7-py3.8.egg\xdis\load.py", line 293, in load_module_from_file_object
    co = marshal.loads(bytecode)
ValueError: bad marshal data (unknown type code)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\deanm\anaconda3\Scripts\uncompyle6-script.py", line 33, in <module>
    sys.exit(load_entry_point('uncompyle6==3.7.4', 'console_scripts', 'uncompyle6')())
  File "C:\Users\deanm\anaconda3\lib\site-packages\uncompyle6-3.7.4-py3.8.egg\uncompyle6\bin\uncompile.py", line 193, in main_bin
  File "C:\Users\deanm\anaconda3\lib\site-packages\uncompyle6-3.7.4-py3.8.egg\uncompyle6\main.py", line 316, in main
  File "C:\Users\deanm\anaconda3\lib\site-packages\uncompyle6-3.7.4-py3.8.egg\uncompyle6\main.py", line 183, in decompile_file
  File "C:\Users\deanm\anaconda3\lib\site-packages\xdis-5.0.7-py3.8.egg\xdis\load.py", line 163, in load_module
    return load_module_from_file_object(
  File "C:\Users\deanm\anaconda3\lib\site-packages\xdis-5.0.7-py3.8.egg\xdis\load.py", line 306, in load_module_from_file_object
    raise ImportError(
ImportError: Ill-formed bytecode file test_decompile.pyc
<class 'ValueError'>; bad marshal data (unknown type code)

Here are screenshots of me attempting to convert the debugger output to a PYC file (in order from copy to paste):

enter image description here

enter image description here
<p>I am trying to completely de-compile an EXE file I made using <em>Pyinstaller</em>. I am using a tool called <em>pyinstxtractor</em> AKA <em>PyInstallerExtractor</em> to debug the EXE. I am trying to convert the output of the debugger to a PYC file, but when I prepend the magic numbers from a current PYC file within the output of the debugger to the output I am converting to a PYC file I think the file gets corrupt, like I am doing it wrong. The reason I think this is because I am using <em>uncompyle6</em> to convert the PYC file back to Python code I get this error:</p>
<pre><code># path . must point to a Python source that can be compiled, or Python bytecode (.pyc, .pyo)

File '-o' doesn't exist. Skipped
Traceback (most recent call last):
File "C:\Users\deanm\anaconda3\lib\site-packages\xdis-5.0.7-py3.8.egg\xdis\load.py", line 293, in load_module_from_file_object
co = marshal.loads(bytecode)
ValueError: bad marshal data (unknown type code)
Traceback (most recent call last):
File "C:\Users\deanm\anaconda3\lib\site-packages\xdis-5.0.7-py3.8.egg\xdis\load.py", line 293, in load_module_from_file_object
co = marshal.loads(bytecode)
ValueError: bad marshal data (unknown type code)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\deanm\anaconda3\Scripts\uncompyle6-script.py", line 33, in <module>
sys.exit(load_entry_point('uncompyle6==3.7.4', 'console_scripts', 'uncompyle6')())
File "C:\Users\deanm\anaconda3\lib\site-packages\uncompyle6-3.7.4-py3.8.egg\uncompyle6\bin\uncompile.py", line 193, in main_bin
File "C:\Users\deanm\anaconda3\lib\site-packages\uncompyle6-3.7.4-py3.8.egg\uncompyle6\main.py", line 316, in main
File "C:\Users\deanm\anaconda3\lib\site-packages\uncompyle6-3.7.4-py3.8.egg\uncompyle6\main.py", line 183, in decompile_file
File "C:\Users\deanm\anaconda3\lib\site-packages\xdis-5.0.7-py3.8.egg\xdis\load.py", line 163, in load_module
return load_module_from_file_object(
File "C:\Users\deanm\anaconda3\lib\site-packages\xdis-5.0.7-py3.8.egg\xdis\load.py", line 306, in load_module_from_file_object
raise ImportError(
ImportError: Ill-formed bytecode file test_decompile.pyc
<class 'ValueError'>; bad marshal data (unknown type code)
</code></pre>
<p>Here are screenshots of me attempting to convert the debugger output to a PYC file (in order from copy to paste):</p>
<p><a href="https://i.sstatic.net/hRWkq.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/hRWkq.png" alt="enter image description here" /></a></p>
<p><a href="https://i.sstatic.net/AVDqu.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AVDqu.png" alt="enter image description here" /></a></p>
 

Latest posts

D
Replies
0
Views
1
Damiano Miazzi
D
Top