Protecting Python Code

Started by
14 comments, last by Monty Python 20 years, 9 months ago
I''ve recently started to learn Python and am wondering if there are any good methods to protect the source code when distributing programs. The only way I know is to force the user to sign a legal document before using the program/script but that isn''t very practical. Has anybody got any ideas?
GSACP: GameDev Society Against Crap Posting
To join: Put these lines in your signature and don't post crap!
Advertisement
source obsufication is one way.

Or encrypt the python source and have your program decrypt it. This would be begging people to crack it though.

Or both.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Why would you want to protect the source code of a python program?
The same reason you would want to protect any of your source code; to stop people stealing it and passing it off as their own work.
GSACP: GameDev Society Against Crap Posting
To join: Put these lines in your signature and don't post crap!
Why give away the source code at all? If you don't want anyone to see it, just don't ship it. just ship the .pyc files.

[edited by - VolkerG on July 2, 2003 6:10:25 PM]
Are .pyc files sort of like compiled .py files? And how do I go about creating them?
GSACP: GameDev Society Against Crap Posting
To join: Put these lines in your signature and don't post crap!
You are WAY too paranoid. If your program is any good (which we can assume it will be since you''re planning on distributing it to a lot of people), then people will know about it. Release it under the GPL, and then if someone wants to use it, that''s fine. They will have to publish their source code too. That''s the POINT of open source. You release some code, someone else sees what you did and they improve it. You see what they did, you improve it, etc. That is a GOOD THING.

Go here and pick whichever viewpoint you''re coming from (business, consumer, hobbyist) and read about the benefits of open source. There are really very few reasons to not release what you have as open source, especially if it''s going to mean you have to do extra work to avoid making it open source.
quote:Original post by Russell
Release it under the GPL, and then if someone wants to use it, that''s fine. [...] There are really very few reasons to not release what you have as open source, especially if it''s going to mean you have to do extra work to avoid making it open source.

One of those reasons - not entirely uncommon - is the desire to make money by selling your programs. That''s rather difficult with a licence that allows other people to redestribute them for free. Don''t get me wrong, I like open source software, but I also have a certain measure of understanding for people who don''t want to give away the fruits of their labour.
You could always try using Jython to compile your stuff to Java .class files.

edit: Oh yeah, instead of preaching OSS goodness (which is indeed good) let's stick to answering his question.

I'm hip because I say "M$" instead of "MS".

[edited by - the speed bump on July 2, 2003 9:09:30 PM]
"There is only one everything"
quote:Original post by the Speed Bump
You could always try using Jython to compile your stuff to Java .class files.

Uh, that won''t help much. Reverse engineering .class files is pretty easy.


AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]

This topic is closed to new replies.

Advertisement