0

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.

Nick_2440
  • 75
  • 1
  • 13
  • 1
    PyInstxtractor author here. If you're using the latest version, there's no need to manually fix the magic number. Check the [Wiki](https://github.com/extremecoders-re/pyinstxtractor/wiki/Frequently-Asked-Questions#do-i-need-to-fix-the-header-of-the-extracted-pycs). However, do note that you must use the same version of Python which was used to build the executable. – Extreme Coders Dec 15 '20 at 06:21
  • Thankyou! It turns out I was using an old version from sourcefourge, my problem is fixed now – Nick_2440 Dec 15 '20 at 13:06

0 Answers0