----------------------------- On Wed, May 6, 2015 11:04 AM CEST Steven D'Aprano wrote:
>On Wednesday 06 May 2015 17:23, Palpandi wrote: > >> On Wednesday, May 6, 2015 at 12:07:13 PM UTC+5:30, Palpandi wrote: >> Hi, >> >> What are the ways to encrypt python files? >> >> No, I just want to hide the scripts from others. > >Why, are you ashamed of your code? > >Python is free, open source software. Hiding the code from others is not a >priority for the developers of the language. Besides, you can't hide the >code unless you only operate the application via a web service, or similar. >As soon as you give people a copy of the code, whether it is binary code or >source code, they have a copy of it and can look at it and work out how what >it does. > >If "hiding the code" was good for security, why are there so many viruses >and spybots and worms and other malware for Windows? > >No, as far as I am concerned, trying to hide the code is a waste of time >with Python. But if you absolutely must, you can distribute the .pyc files >instead of the .py files, and that will discourage casual tinkerers from >poking around in the program. The .pyc file is compiled to byte-code rather >than source code, so it's not readable without running it through a >decompiler. I used the marshal module before as a faster alternative to shelve (I marshalled a huge dictionary). I always understood marshal files require the *exact* same interpreter version (incl. built number). Do the same limitations apply for .pyc files? Isn't it the same format? We have a VCS with an option to use private repos. I am always wary of users who want to use this feature. Why would you not want to share your code with your colleagues? Embarrassed about unreadable crappy code, perhaps? -- https://mail.python.org/mailman/listinfo/python-list