0

I have an .exe file where file compiled by py2exe in my .exe folder I have some .dll files, one .exe file and library.zip file and inside this zip I have to many .pyccompiled files.

I have decompiled this files from library.zip using Easy Python Decompiler and that program created me new file where I can see and change my code.

I have opened this file where I needed and I changed my code using python editor and finaly I saved as new script code with the some name and extension .pyc with purpose to replace first .pyc.

zip again library folder and I tried to run .exe prgram but after the changes the program doesn't execute.

What have I done wrong in my task? Do I need to re-compile again in some way?

ForceBru
  • 43,482
  • 10
  • 63
  • 98
Chris Papas
  • 249
  • 5
  • 20
  • 1
    If you have the code, try re-running py2exe. I don't think it is the best idea to stick with the same exe file. – cookiedough Jun 14 '17 at 15:19

1 Answers1

4

pyc and py file are NOT the same. While they represent the same code, they are totally different :

  • the py file represents the code you are typing, can be interpreted by the python interpreter, is not native, and is portable

    • the pyc file is a compiled version of the py file, that is not portable, not intended to be modified by an human, but faster

You cannot swap them and expect it to work. You will need to compile it to pyc before. You will find more information here : How can I manually generate a .pyc file from a .py file

Anthony Rossi
  • 1,182
  • 8
  • 14
  • i test this soon,first i need to compile it to pyc and after replace ?correct ? – Chris Papas Jun 14 '17 at 17:39
  • In my opinion, you should not use the same exe file, but yes, if everything goes well, compiling then replacing might work. Please note that this is in no way a good practice to replace binary blobs inside an exe file however – Anthony Rossi Jun 15 '17 at 07:07
  • thanx you very much problem solved with replace,what is the other option if replace not work ? – Chris Papas Jun 15 '17 at 17:08