Creating .exe file in Python

Chris Angelico rosuav at gmail.com
Wed Jun 17 09:52:02 EDT 2015


On Wed, Jun 17, 2015 at 11:33 PM, hamilton <hamilton at nothere.com> wrote:
> On 6/17/2015 7:20 AM, Chris Angelico wrote:
>>
>> On Wed, Jun 17, 2015 at 11:10 PM,  <subhabrata.banerji at gmail.com> wrote:
>>>
>>> Thank you all. It seems going fine now. I have one additional question if
>>> I run the .exe files created in Non Python Windows environment. Linux has
>>> Python builtin but in Non Python environment how may I run it? Is there any
>>> set of prequisites I have to follow. I am not finding much web help, if any
>>> one may kindly suggest.
>>>
>>
>> There have been some proposals to make an easy way to produce a single
>> package that has a Windows executable header, but can be easily
>> unpacked and run using a system-provided Linux or Mac OS Python.
>> However, I don't think any have been deployed yet. So the simple
>> answer is: You can't do what you're trying to do. Instead, take a step
>> back, and look at just getting your Python program to run on all
>> platforms... and that's easy, just distribute the .py files. Much MUCH
>> easier, more reliable, and simpler.
>>
>> ChrisA
>>
> Yes, this is easy.
>
> However, the python source can be read by anyone.
>
> As a .exe, the source can not be read.
>
> Just because the interpreter is open source,
> does not mean my application should be.

Actually, all you've done is obscure your code. This is a very common
fallacy; people think that since they cannot themselves read the code
out of what they're distributing, nor can anyone else. There's no way
to completely stop people from reading your code other than to not
give them the code.

If you truly want to protect your code from prying eyes, therefore,
there's only one way to do it: host it on a server, and let people
access the server without seeing the code. This is true of all
languages, not just Python, and it's always been the way. You can try
to put legal guards around your code ("opening this package
constitutes acceptance, blah blah, you agree that you will not reverse
engineer, disassemble, blah blah"), but that won't stop people. It's
best to either give them the code and let them see it clearly (open
source) or keep the code away from them in all forms (server-side
deployment).

ChrisA



More information about the Python-list mailing list