When one launches pyinstxtractor with a python interpetor that has a different version than the one used in the packed python script, then the header of the current used python version is put in the pyc header instead of the version packed.
As this seems to be intentional, what is the reason for this?
It is checked here:
if pyc_magic != pycHeader:
print('[!] Warning: This script is running in a different Python version than the one used to build the executable.')
print('[!] Please run this script in Python {0}.{1} to prevent extraction errors during unmarshalling'.format(self.pymaj, self.pymin))
print('[!] Skipping pyz extraction')
return
but when writing the file we could just put pycHeader instead of pyc_magic and it would solve the python version problem.
pycFile.write(pyc_magic) #why not use pycHeader here?
I understand it may not be unmarshalled in some cases but at least the generated pyc file would be correct.
Hi,
When one launches pyinstxtractor with a python interpetor that has a different version than the one used in the packed python script, then the header of the current used python version is put in the pyc header instead of the version packed.
As this seems to be intentional, what is the reason for this?
It is checked here:
but when writing the file we could just put pycHeader instead of pyc_magic and it would solve the python version problem.
I understand it may not be unmarshalled in some cases but at least the generated pyc file would be correct.