Jump to content

  • Log In with Google      Sign In   
  • Create Account


once a py2exe program is compiled, can you modify the program without having a python interpreter?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Claude Fleming   Members   -  Reputation: 107

Like
0Likes
Like

Posted 22 April 2013 - 07:12 AM

Note: I meant to type, "Can you edit the python program without manually installing a python interpreter?"

 

Hello,

 

I have been a member several times for many years, but have lost my account info. I greatly appreciate

the help I get on these forums.

 

I love Linux, and have a Windows 7 PC, but use VirtualBox to run Linux, using Ubuntu in particular, because I simply like the Operating system that much. smile.png

 

Anyway, I was wondering if py2exe actually compiled a python interpreter within an exe, if this is the case, which seems only logical, otherwise how would the program run? 

 

My question is, since the program is compiled, is the Python code somehow turned into machine code,

so that any tweaking or editing of Python source code is impossible? In short, can the program, once

compiled and run on Windows, ever be modified with other Python code?

 

Thanks! smile.png

 

Claude


Edited by Claude Fleming, 22 April 2013 - 07:18 AM.


Sponsor:

#2 Nickie   Members   -  Reputation: 319

Like
0Likes
Like

Posted 22 April 2013 - 09:08 AM

Simply, no.

The standart implementation of python(CPython) compiles the code only to bytecode.

 

For freeze - It saves the python bytecode as a C array and compile it in exe. then It simply run it by the interpreter.

I guess py2exe use a similar way(as far as I know it does not require compiler).

P.S.

http://stackoverflow.com/questions/2912404/how-does-py2exe-actually-and-simply-explained-work

If you don't want to read this: It still uses the standart interpreter to execute python bytecode. It is not turned into machine code.

 

Basically if someone decide to read your code or modify it, you cannot stop him. (Even if its in machine code/bytecode)

 

Also python bytecode keeps variables and function names, so I guess the source can be completely recovered from bytecode(without comments).


Edited by Nickie, 22 April 2013 - 09:12 AM.


#3 Claude Fleming   Members   -  Reputation: 107

Like
0Likes
Like

Posted 22 April 2013 - 08:11 PM

I apologize for my sloppy writing and wording of my question.

 

Thanks for replying.

 

Now, to embed Python applications and have them run on the host computer, without annoying the user who doesn't want

to install a Python interpreter to run your hybrid program, those embedding programs actually clandestinely install a Python interpreter,

correct? If so, could the user script parts of the program without having to "manually" install a Python interpreter. I know that is illogical.

What I mean is, is it possible for the user to write scripts for the program after it has been compiled with one of those two programs you mentioned? I just want to expand my horizons a little bit. I know I sound a little loopy.

 

Thanks,

Lee


Edited by Claude Fleming, 22 April 2013 - 08:12 PM.


#4 SimonForsman   Crossbones+   -  Reputation: 5972

Like
0Likes
Like

Posted 23 April 2013 - 12:49 AM

I apologize for my sloppy writing and wording of my question.

 

Thanks for replying.

 

Now, to embed Python applications and have them run on the host computer, without annoying the user who doesn't want

to install a Python interpreter to run your hybrid program, those embedding programs actually clandestinely install a Python interpreter,

correct? If so, could the user script parts of the program without having to "manually" install a Python interpreter. I know that is illogical.

What I mean is, is it possible for the user to write scripts for the program after it has been compiled with one of those two programs you mentioned? I just want to expand my horizons a little bit. I know I sound a little loopy.

 

Thanks,

Lee

 

Not easily, they would have to modify the .exe for that (unless you have your program explicitly load the scripts and run them through the eval function).

 

Modifying the .exe isn't extremely hard though so if it is a multiplayer game you should never trust the client (regardless of what language the client is written in)


I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#5 Claude Fleming   Members   -  Reputation: 107

Like
0Likes
Like

Posted 23 April 2013 - 07:16 AM

Thank you. That helped me understand what I was doing with my test program. I have one question: How do players modify precompiled games using scripts?






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS