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

Started by
3 comments, last by Claude Fleming 10 years, 11 months ago

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

Advertisement

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).

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

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)

[size="1"]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!

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?

This topic is closed to new replies.

Advertisement