Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #64125
| From | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| Subject | Re: Is it possible to protect python source code by compiling it to .pyc or .pyo? |
| Date | 2014-01-16 20:07 -0500 |
| References | <7bf45fc1-e1c4-44f2-812c-e11ffa2c8ef3@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5614.1389920837.18130.python-list@python.org> (permalink) |
On 1/16/14 7:58 PM, Sam wrote: > I would like to protect my python source code. It need not be foolproof as long as it adds inconvenience to pirates. > > Is it possible to protect python source code by compiling it to .pyc or .pyo? Does .pyo offer better protection? > First, .pyc and .pyo are nearly identical: they are bytecode. The only difference is that .pyo has been "optimized", which in this case simply means that the docstrings and asserts are gone. It is not difficult to see what a Python program does by looking at the bytecode, and the standard library includes the dis module for disassembling it. How to protect your code depends an awful lot on what kinds of secrets are in the code, and how valuable those secrets are, and therefore how hard someone will work to get at them. -- Ned Batchelder, http://nedbatchelder.com
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is it possible to protect python source code by compiling it to .pyc or .pyo? Sam <lightaiyee@gmail.com> - 2014-01-16 16:58 -0800 Re: Is it possible to protect python source code by compiling it to .pyc or .pyo? Ned Batchelder <ned@nedbatchelder.com> - 2014-01-16 20:07 -0500 Re: Is it possible to protect python source code by compiling it to .pyc or .pyo? Ben Finney <ben+python@benfinney.id.au> - 2014-01-17 12:07 +1100 Re: Is it possible to protect python source code by compiling it to .pyc or .pyo? Chris Angelico <rosuav@gmail.com> - 2014-01-17 12:09 +1100 Re: Is it possible to protect python source code by compiling it to .pyc or .pyo? Ethan Furman <ethan@stoneleaf.us> - 2014-01-16 17:21 -0800 Re: Is it possible to protect python source code by compiling it to .pyc or .pyo? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-17 05:11 +0000 Re: Is it possible to protect python source code by compiling it to .pyc or .pyo? Joshua Landau <joshua@landau.ws> - 2014-01-17 21:31 +0000 Re: Is it possible to protect python source code by compiling it to .pyc or .pyo? Tim Delaney <timothy.c.delaney@gmail.com> - 2014-01-18 09:02 +1100
csiph-web