(Python) pyinstxtractor does not produce any .py or .pyc files – how to convert the blank file to a .pyc?

  decompiler, exe, pyc, pyinstaller, python

I used pyinstaller to compile hello_world.py to hello_world.exe. When I run pyinstxtractor on the .exe file, I get a large number of files. I have two problems, the second arose trying to fix the first:

  • pyinstxtractor does not produce any .py or .pyc files. It produces a large number of files but the only one of interest (source) is the hello_world file with no extension.
  • This hello_world file appears to be a .pyc file without the magic number. Using the code here showed that "my" magic number is (in hex) 0x550d0d0a. I viewed the hello_world file in hex using the ASCII --> Hex tool in Notepad++ and put the magic number at the start. I then renamed this file to hello_world.pyc and run it through uncompyle6. This did not work and gave an error: ImportError: Unknown magic number 13621 in hello_world.pyc.

(Related questions, but no-one answered/replied: here and here)

Can anyone offer a solution to either one of these problems, so that I can get .py files from .exe files compiled by pyinstaller again? Noting that other programs such as unpy2exe do not work on pyinstaller .exe‘s.

Any advice is much appreciated.

Source: Python Questions

LEAVE A COMMENT