You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import xdis
from xdis import PYTHON3
from xdis.magics import magics
from xdis.marsh import dumps
from struct import pack
import time
def write_pycfile(pyc_file, code_list, version=xdis.PYTHON_VERSION):
if PYTHON3:
file_mode = 'wb'
else:
file_mode = 'w'
with open(pyc_file, file_mode) as fp:
fp.write(magics[version])
timestamp = int(time.time())
fp.write(pack('I', timestamp))
if version > 3.2:
fp.write(pack('I', 0))
for co in code_list:
try:
co_obj = dumps(co, python_version=str(version))
if PYTHON3 and version < 3.0:
co_obj = str.encode(co_obj)
pass
fp.write(co_obj)
except:
pass
pass
print("Wrote %s" % pyc_file)
write_pycfile("D:\Person_Program\Python_Decompile\test.pyc", [write_pycfile.__code__])
In stackoverflow, there is the code:
then, I run this:
The console shows that the target file is not a pyc type file
My python version is 3.7. does this question have anything to do with my python version?
The text was updated successfully, but these errors were encountered: